: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

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.