summaryrefslogtreecommitdiff
path: root/docs/ref/compat/nn_close.adoc
blob: b44045aec4904329b29b3f7c8586f6dad3bdc2eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
## nn_close

Close socket (compatible API).

### Synopsis

[source,c]
```
#include <nanomsg/nn.h>

int nn_close(int sock);
```

### Description

The `nn_close` function closes the socket _sock_.
Any operations that are currently in progress will be terminated, and will fail with error `EBADF`.

### Return Values

This function returns zero on success, and -1 on failure.

### Errors

[horizontal]
`EBADF`:: The socket is not open.
`ETERM`:: The library is shutting down.

### See Also

xref:nn_errno.adoc[nn_errno],
xref:nn_socket.adoc[nn_socket]