Share this page

# lrs_close_socket

Sockets Functions

Closes an open socket.

    int lrs_close_socket( char *s_desc );

s_desc | A descriptor identifying a socket.

The lrs_close_socket function closes a socket by releasing the specified socket descriptor. Further references to the socket will result in the error WSAENOTSOCK. If this is the last reference to the underlying socket, the associated naming information and queued data are discarded. Note that for a TCP socket, the lrs_close_socket function flushes all data which was not yet sent.

This function is recorded during a Windows Socket session.

## Return Values

Windows Sockets Return Values

## Parameterization

You cannot use standard parameterization for any arguments in this function.

## Example

In the following example, the lrs_close_socket statement closes a socket after a message was sent to the server. Socket 5 was accepted via socket 4, and 256 bytes were sent via socket 5.

    rc= lrs_accept_connection("socket4", "socket5");

    lrs_send("socket5", "buf0", 256, 0);

    lrs_close_socket("socket5");

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: