|
-
January 3rd, 2009, 02:18 PM
#10
Re: C++ Server/Client application
I have noticed strange behavior in the code.
Brief of what server/client do:
- server runs a blocking recv().
- when client has a request, it packs the request into a string, sends the length of the string(4 bytes) to the server, then sends the string itself. Then it calls select() (followed by non blocking recv())with timeout waiting for the server to write the response data length to the socket. Then another select() (followed by non blocking recv()) waiting for the server to write the reponse data itself.
- on the server side, the blocking recv() will return with 4 bytes received, interprets the 4 bytes into a number(length).
- Then the server calls another blocking recv() to receive number of bytes equal the length.
- The server then does so processing, prepare response string, sends its length, then sends the response data bytes.
- The server then goes to the start of the loop again with blocking call of recv() waiting to receive the length of another request.
** The problem occurs in one of the select() function calls on the client. It times out.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|