soclose()

The socket call shuts down a socket and frees resources allocated to the socket.

Syntax

#include <types.h>
#include <unistd.h>
int soclose(s)
int s;

Parameters

s

Description

This call shuts down the socket associated with the socket descriptor s, and frees resources allocated to the socket. If s refers to a connected socket, the connection is closed.

If the SO_LINGER socket option is enabled (see setsockopt() for additional information), then the task will try to send any queued data. If the SO_LINGER socket option is disabled, then the task will flush any data queued to be sent.

Return Values

The value 0 indicates success; the value -1 indicates an error. You can get the specific error code by calling sock_errno() or psock_errno().

Error Code

SOCENOTSOCK SOCEALREADY

Related Calls


[Back: socket()]
[Next: sysctl()]