cSocket: added error logging to Bind() failures

git-svn-id: http://mc-server.googlecode.com/svn/trunk@233 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-02-05 15:41:56 +00:00
parent da87f9f3c1
commit d6925efab3

View File

@ -176,7 +176,16 @@ int cSocket::Bind( SockAddr_In& a_Address )
local.sin_port=htons((u_short)a_Address.Port);
return bind( m_Socket, (sockaddr*)&local, sizeof(local));
int res = bind(m_Socket, (sockaddr*)&local, sizeof(local));
if (res != 0)
{
#ifdef _WIN32
LOGWARNING("bind() failed for port %d, WSAGLE = %d", a_Address.Port, WSAGetLastError());
#else // _WIN32
LOGWARNING("bind() failed for port %d, errno = %d", a_Address.Port, errno);
#endif // else _WIN32
}
return res;
}