Click here to Skip to main content
16,008,010 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Philosophical question Pin
Chris Losinger3-Nov-02 5:33
professionalChris Losinger3-Nov-02 5:33 
GeneralRe: Philosophical question Pin
markkuk2-Nov-02 12:49
markkuk2-Nov-02 12:49 
GeneralRe: Philosophical question Pin
Chris Losinger2-Nov-02 13:34
professionalChris Losinger2-Nov-02 13:34 
GeneralRe: Philosophical question Pin
Anonymous4-Nov-02 4:17
Anonymous4-Nov-02 4:17 
GeneralRe: Philosophical question Pin
Gary R. Wheeler5-Nov-02 10:41
Gary R. Wheeler5-Nov-02 10:41 
QuestionDoes anyone know this error?? Pin
Pett2-Nov-02 8:50
Pett2-Nov-02 8:50 
AnswerRe: Does anyone know this error?? Pin
Anonymous2-Nov-02 13:42
Anonymous2-Nov-02 13:42 
GeneralRe: Does anyone know this error?? Pin
Pett3-Nov-02 4:48
Pett3-Nov-02 4:48 
Thank you so much for replying to me.Smile | :)

The following is my send code when the button is clicked. I found most of it on this site:

void CMainFrame::OnSFile() <br />
<br />
{<br />
MessageBox("File Transfer");<br />
<br />
CSocket cSocket;<br />
cSocket.Create();<br />
//cSocket.Connect((LPCTSTR(m_strServerIP)),m_iFTPort);<br />
cSocket.Connect("127.0.0.1", 700);<br />
<br />
csocketfile sf(&cSocket);<br />
CArchive ar(&sf, CArchive::store);<br />
<br />
/*code for CFileDialog goes here*/<br />
<br />
static char BASED_CODE szFilter[] = "All Files (*.*)|*.*||";<br />
<br />
CString strPath;<br />
<br />
CFileDialog m_ldFile(TRUE,".*","*.*",OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter);<br />
<br />
// Initialize the starting directory<br />
//m_ldFile.m_ofn.lpstrInitialDir = _T("C:\\");<br />
<br />
// Show the file open dialog and captures the result<br />
//if IDOK<br />
if (m_ldFile.DoModal() == IDOK)<br />
{<br />
<br />
strPath = m_ldFile.GetPathName();<br />
CFile myFile(strPath,<br />
CFile::modeRead | CFile::typeBinary); <br />
 <br />
//get file info <br />
DWORD length = myFile.GetLength();<br />
 char *data = new char[length];<br />
 myFile.Read(data, length);<br />
 <br />
//send it across<br />
ar << myFile.GetFileName();<br />
ar << length;<br />
ar.Write(data, length);<br />
delete[] data;<br />
myFile.Close();<br />
<br />
}<br />
<br />
 }

--------------------------------------------------------------------------

On the server side, I've put this as the receiving code. Maybe I've put it in the wrong place?Unsure | :~

There is a void
CClientSocket::OnReceive(int nErrorCode) which is an overrided method
from the CSocket class. So basically whenever the socket receives
something, it kicks off the OnReceive code. I've put it there.

Also, in my Send code, there is a line commented off, and replaced with a hardcoded statement. Before I did that I was getting another error, "An unknown error occurred while accessing an unnamed file"

I'm going to try changing around a few things, but if you have any suggestions on thoughts on this, please let me know.

Thank you so much.
QuestionNewbie question - C++ 6.0 Pro or Standard? Pin
jta2-Nov-02 8:17
jta2-Nov-02 8:17 
AnswerRe: Newbie question - C++ 6.0 Pro or Standard? Pin
ian mariano2-Nov-02 10:04
ian mariano2-Nov-02 10:04 
GeneralI/O Completion Port and Queue Status :: Winsock Pin
valikac2-Nov-02 8:04
valikac2-Nov-02 8:04 
GeneralRe: I/O Completion Port and Queue Status :: Winsock Pin
ian mariano2-Nov-02 10:09
ian mariano2-Nov-02 10:09 
Generalexplicit linking to DLLs Pin
tUpp2-Nov-02 7:32
tUpp2-Nov-02 7:32 
GeneralRe: explicit linking to DLLs Pin
ian mariano2-Nov-02 14:00
ian mariano2-Nov-02 14:00 
GeneralToolBar Pin
sikrip2-Nov-02 6:55
sikrip2-Nov-02 6:55 
GeneralRe: ToolBar Pin
includeh102-Nov-02 7:07
includeh102-Nov-02 7:07 
GeneralDispatchMessage vs own function Pin
S van Leent2-Nov-02 4:55
S van Leent2-Nov-02 4:55 
GeneralRe: DispatchMessage vs own function Pin
ian mariano2-Nov-02 6:38
ian mariano2-Nov-02 6:38 
GeneralRe: DispatchMessage vs own function Pin
S van Leent2-Nov-02 10:12
S van Leent2-Nov-02 10:12 
GeneralRe: DispatchMessage vs own function Pin
Paul M Watt2-Nov-02 10:14
mentorPaul M Watt2-Nov-02 10:14 
GeneralRe: DispatchMessage vs own function Pin
S van Leent2-Nov-02 10:21
S van Leent2-Nov-02 10:21 
GeneralRe: DispatchMessage vs own function Pin
ian mariano2-Nov-02 15:19
ian mariano2-Nov-02 15:19 
GeneralRe: DispatchMessage vs own function Pin
S van Leent2-Nov-02 10:54
S van Leent2-Nov-02 10:54 
GeneralStrange List Box Problem Pin
Ayush2-Nov-02 4:36
Ayush2-Nov-02 4:36 
GeneralRe: Strange List Box Problem Pin
ian mariano2-Nov-02 10:40
ian mariano2-Nov-02 10:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.