Hello,
gcc 4.4.4 c89
Visual Studio VC++ 2008
I am writing a cross platform client server application. It will run on both linux and windows.
However, I am just wondering what I have done for closing the sockets is correct. I close the file descriptor. However, if there is a problem with closing it. What is the best way to handle this. Maybe some data is still being sent or received?
Many thanks for any advice,
if(close(sockfd) == -1)
{
#if defined ( _WIN32 )
fprintf(stderr, "[ %d ] [ %s ] [ %s ] [ %d ]\n",
WSAGetLastError(), strerror(errno), __func__, __LINE__);
#elif( __linux__ )
fprintf(stderr, "[ %s ] [ %s ] [ %d ]\n", strerror(errno), __func__, __LINE__);
#endif
return CS_FAILURE;
}