SYNOPSIS
#include <nanomsg/nn.h>
int nn_close (int s);
DESCRIPTION
Closes the socket s. Any buffered inbound messages that were not yet received by the application will be discarded. The library will try to deliver any outstanding outbound messages for the time specified by NN_LINGER socket option. The call will block in the meantime.
RETURN VALUE
If the function succeeds zero is returned. Otherwise, -1 is returned and errno is set to to one of the values defined below.
ERRORS
- EBADF
-
The provided socket is invalid.
- EINTR
-
Operation was interrupted by a signal. The socket is not fully closed yet. Operation can be re-started by calling nn_close() again.
EXAMPLE
int s = nn_socket (AF_SP, NN_PUB); assert (s >= 0); int rc = nn_close (s); assert (rc == 0);