xs_close(3)
===========


NAME
----
xs_close - close Crossroads socket


SYNOPSIS
--------
*int xs_close (void '*socket');*


DESCRIPTION
-----------
The _xs_close()_ function shall destroy the socket referenced by the 'socket'
argument. Any outstanding messages physically received from the network but not
yet received by the application with _xs_recv()_ shall be discarded. The
behaviour for discarding messages sent by the application with _xs_send()_ but
not yet physically transferred to the network depends on the value of the
_XS_LINGER_ socket option for the specified 'socket'.

NOTE: The default setting of _XS_LINGER_ does not discard unsent messages;
this behaviour may cause the application to block when calling _xs_term()_.
For details refer to linkxs:xs_setsockopt[3] and linkxs:xs_term[3].


RETURN VALUE
------------
The _xs_close()_ function shall return zero if successful. Otherwise it shall
return `-1` and set 'errno' to one of the values defined below.


ERRORS
------
*ENOTSOCK*::
The provided 'socket' was invalid.


SEE ALSO
--------
linkxs:xs_socket[3]
linkxs:xs_term[3]
linkxs:xs_setsockopt[3]
linkxs:xs[7]


AUTHORS
-------
The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
and Martin Lucina <martin@lucina.net>.
