---
name: "xs_close"
section: "3"
platform: "linux"
package: "libxs-dev"
version: "1.2.0-2"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/xs_close"
---

# xs\_close(3)

close Crossroads socket

## 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 [**xs\_setsockopt**(3)](/xs_setsockopt/3.md) and [**xs\_term**(3)](/xs_term/3.md).

## 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

[**xs\_socket**(3)](/xs_socket/3.md) [**xs\_term**(3)](/xs_term/3.md) [**xs\_setsockopt**(3)](/xs_setsockopt/3.md) [**xs**(7)](/xs/7.md)

## AUTHORS

The Crossroads documentation was written by Martin Sustrik \<**sustrik@250bpm.com**\[1\]\> and Martin Lucina \<**martin@lucina.net**\[2\]\>.

## NOTES

- 1\.

  sustrik@250bpm.com

  mailto:sustrik@250bpm.com

- 2\.

  martin@lucina.net

  mailto:martin@lucina.net
