File Transfer using sockets in VC++

hi
I need to transfer a file from one system to another over LAN.
I use the code given at

http://www.thecodeproject.com/internet/SocketFileTransfer.asp

At the receiving side, it givens error WSAEWOULDBLOCK. No. of bytes received is -1. A blank file is created at the receiving side.

Any clue please.
[335 byte] By [mcastuds] at [2007-11-19 18:30:09]
# 1 Re: File Transfer using sockets in VC++
The article you cited uses sckets in "blocking" mode, in which it is impossible to get WSAEWOULDBLOCK. It is only possible to get WSAEWOULDBLOCK with sockets in non-blocking mode.

Did you modify the article's code? If so, you need to show us your code (please use [ code][ /code] tags).

Anyway, WSAEWOULDBLOCK is a perfectly normal error code, which indicates that Winsock is too busy to accept more data for transmission, or doesn't have data ready for receipt. It means to go away for now, but come back again later when Winsock sends you a FD_READ or FD_WRITE notification. When using sockets in non-blocking mode, your code must be prepared to handle this "error" at any time.

Mike
MikeAThon at 2007-11-9 13:52:17 >