Closes a previously opened socket.
[ lStatus = ] WsClose ( socket )
The WsClose procedure syntax has the following parts:
Name |
Type |
Description |
lStatus |
Long |
Status code. Returns 0 if successful, -1 if failed. |
socket |
Val ASocket |
A descriptor identifying a socket to be closed. |
Close the connection with the WsClose function.
When data exchange between the server and client ends, close the socket with WsClose.
An application should always have a matching call to WsClose for each successful call to WsCreate, to return any socket resources to the system. For TCP stream sockets, when a socket connection ends the server closes the socket created by WsAccept. The server does not close the socket originally returned by the first call to WsCreate. That socket continues to listen for clients. When the server disconnects or is out of service it should call WsClose to close the listening socket.
The following example closes a previously opened socket:
lReturn1 = WsClose(lSocket1)