Winsock API: closesocket

来源:互联网 发布:手机制作动画片软件 编辑:程序博客网 时间:2024/05/06 23:17

参考MSDN:http://msdn.microsoft.com/en-us/library/windows/desktop/ms737582(v=vs.85).aspx

The closesocket function closes an existing socket.

Syntax


int closesocket(
  _In_  SOCKET s
);

Parameters

s [in]

A descriptor identifying the socket to close.

Return value

If no error occurs, closesocket returns zero. Otherwise, a value ofSOCKET_ERROR is returned, and a specific error code can be retrieved by callingWSAGetLastError.

Remarks

The closesocket function closes a socket. Use it to release the socket descriptor passed in thes parameter. Note that the socket descriptor passed in the s  parameter may immediately be reused by the system as soon asclosesocket function is issued. As a result, it is not reliable to expect further references to the socket descriptor passed in thes parameter to fail with the error WSAENOTSOCK. A Winsock client must never issue closesocket ons concurrently with another Winsock function call.

 

原创粉丝点击