Archived

This topic is now archived and is closed to further replies.

mr_foo

Server trouble!!!!! Grrrrrrrr!!!

Recommended Posts

Hello, I made a client program and a server program. The server operates on port 4545. I tried the client out with my friend''s server (just a DOS program), and the client can connect, disconnect and transmit data fine. So - i tried connecting to my server and i can connect, but i cannot transfer data. My current program operates like this : CMySocket : public CAsyncSocket; this is just to override the virtual functions like : CMySocket::OnReceive() { char data[5024]; Receive(data,sizeof(data),0); } and then it displays it as a message box, just to avoid any MFC complication between classes at this point. so, my dialog class has a member variable of the CMySocket type, called serv or something. then, on initiation i''d do this : initiation { serv.Create(4545); serv.Bind(4545); serv.Listen(); serv.Accept(); } any help would be appreciated thanx -=brendan=- ------------------------------ Peace, love and Foo

Share this post


Link to post
Share on other sites
How much error checking do you do on the connection and transfer?
Something might be failing...

i''m new to csocket, and am mucking with streams, not datagrams as you are, but i don''t think you need to call the .accept method right after the listen, if its a blocking socket the program will hang on the listen or the accept, i forget which, until it does its job (no more msg''s or anything get processed by your program)

again i may be wrong, but i wouldn''t expect datagram sockets to need/call the accept or OnAccept function because no such pipe is created with them...

Share this post


Link to post
Share on other sites
Im not using datagram, im using the stream architechture. Anything else to add- anyone?

------------------------------
Peace, love and Foo

Share this post


Link to post
Share on other sites
dont forget to flush your socket input and output buffers every time you send a cluster of data, or the data won''t get fully sent I dont think.

just an idea......

Share this post


Link to post
Share on other sites