On 11/7/05, Tyler Littlefield <compgeek13@gmail.com> wrote:
Hello,
I see some problems with this code, that the reader might want to think
about.
1, the gotos are some um... I don't know how to describe this and be ni e.
lol. The code should probably be separated in to functions.

It is pretty clear what is going on with the gotos.  Sure, it could easily be refactored, but IMHO there is nothing inherently evil about a goto.

2. Some of those have more than one error, while it is only testing for one
error. Some more error checking will be needed.

That is not how errors work with the winsock functions.  They return SOCKET_ERROR on error and you use WSAGetLastError() to determine the exact error.

3. The program needs to be sure that the socket exists.

I'm not sure what you mean here; if the function returns -1 (like pipe()) it has failed.

-D