nn_errno - Man Page

retrieve the current errno

Synopsis

#include <nanomsg/nn.h>

int nn_errno (void);

Description

Returns value of errno for the current thread.

On most systems, errno can be accessed directly and this function is not needed. However, on Windows, there are multiple implementations of the CRT library (single-threaded, multi-threaded, release, debug) and each of them has its own instance of errno. Thus, if nanomsg library and the application that uses it link with different versions of the CRT library, they don’t share the same instance of errno. Consequently, error codes set by nanomsg cannot be accessed by the application. To overcome this problem, application can use nn_errno() function to retrieve nanomsg’s value of errno.

Return Value

Returns value of errno for the current thread.

Errors

No errors are defined.

Example

rc = nn_send (s, "ABC", 3, 0);
if (rc < 0)
    printf ("nn_send failed with error code %d\n", nn_errno ());

See Also

nn_strerror(3) nanomsg(7)

Authors

Martin Sustrik

Referenced By

nanomsg(7), nn_get_statistic(3), nn_strerror(3), nn_symbol(3), nn_symbol_info(3).

2024-01-25 nanomsg 1.1.5