How To Send data on a Non-blocking Socket RRS feed

  • Question

  • Hi,

    My assignment is to read from a list of files and send this data over TCP\IP. Sender should be using non-blocking socket and sending in chunks of 256k while receiver should be reading on a blocking socket in chunks of 64k.

    First, I tried with even the sender having a blocking socket and the code worked. But, when I changed the sender socket to non-blocking, code stopped working. (Used ioctlsocket to change to non-blocking mode after the connect call.)

    It seems that sender sends the first chunk of 262k in one shot and receiver receives it in pieces. But, after sending the first chunk, I get winsock error 10035(WSAEWOULDBLOCK).

    I thought just changing the sending socket to non-blocking will make my app work out of the box but thats not the case. Can anyone point out what extra steps needs to be performed for non-blocking sockets?

    Also, I don't wish to use select call which I believe is blocking by nature. As I want to send the data asynchronously.

    Tuesday, September 8, 2009 6:21 PM