0

:sad:

Codes:

if (sock!=INVALID_SOCKET)
    {
 if(send(sock,s,(int)strlen(s),0)==SOCKET_ERROR)
        {
            WSAGetLastError();
        }
    }

s is a char pointer pointing to the very first memory location of the data string.

While in debugging mode, there was no error from WSAGetLastError(), but the data string was not displayed in the server.
Why?

Thanks

Edited by pyTony: fixed formatting

2
Contributors
2
Replies
3
Views
11 Years
Discussion Span
Last Post by yuzhang
0

I would use something like

if (sock!=INVALID_SOCKET)
{
     if(send(sock,s,(int)strlen(s),0)==SOCKET_ERROR)
     {
         printf("Sendfailed.%d", WSAGetLastError());
     }
}

and see.

0

Hi wolf:

Good to receive help from you again. I have found the problem, which is I did not quite employ criticalsection method properly. I pretty much used one criticalsection varaible for multiple processes, now I have changed it to one criticalsection for one process. It seems to be working.

Thanks

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.