socket connect 后 closesocket 连接无法释放么?解决方案
socket connect 后 closesocket 连接无法释放么?
connect 完毕立刻 closesocket 连接无法释放么?
我再两个操作间加上Sleep(一定时间)
这样服务器才能释放掉连接。这是怎么回事?
------解决方案--------------------
WSAGetLastError function
------解决方案--------------------
If no error occurs, closesocket returns zero. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError.
WSANOTINITIALISED
A successful WSAStartup call must occur before using this function.
WSAENETDOWN
The network subsystem has failed.
WSAENOTSOCK
The descriptor is not a socket.
WSAEINPROGRESS
A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function.
WSAEINTR
The (blocking) Windows Socket 1.1 call was canceled through WSACancelBlockingCall.
WSAEWOULDBLOCK
The socket is marked as nonblocking, but the l_onoff member of the linger structure is set to non-zero and the l_linger member of the linger structure is set to a nonzero timeout value.
connect 完毕立刻 closesocket 连接无法释放么?
我再两个操作间加上Sleep(一定时间)
这样服务器才能释放掉连接。这是怎么回事?
------解决方案--------------------
WSAGetLastError function
------解决方案--------------------
int closesocket(
__in SOCKET s
);
If no error occurs, closesocket returns zero. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError.
WSANOTINITIALISED
A successful WSAStartup call must occur before using this function.
WSAENETDOWN
The network subsystem has failed.
WSAENOTSOCK
The descriptor is not a socket.
WSAEINPROGRESS
A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function.
WSAEINTR
The (blocking) Windows Socket 1.1 call was canceled through WSACancelBlockingCall.
WSAEWOULDBLOCK
The socket is marked as nonblocking, but the l_onoff member of the linger structure is set to non-zero and the l_linger member of the linger structure is set to a nonzero timeout value.