sockaddr_to_string

March 26, 2020 Contributors

Name

sockaddr_to_string — Renders a socket address into human-readable form

Synopsis

#include "netlistener.h"

| char * **sockaddr_to_string** ( | sa, |   |
|   | buffer, |   |
|   | len); |   |

struct sockaddr * <var class="pdparam">sa</var>;
char * <var class="pdparam">buffer</var>;
int * <var class="pdparam">len</var>;

Description

Renders a socket address into human-readable form.

Note

You may find that sockaddr_to_string2 is slightly easier to use.

Parameters

sa

The socket address.

buffer

The target for the human-readable form of the socket address.

Note

If the buffer is NULL on input, then a static, thread-unsafe buffer will be used and returned.

len

The buffer length.

Note

*l must store the buffer size. As as side effect, *l will be updated with the length of the rendered string.

Return Values

Returns the buffer that was used for rendering the socket address.

Threading

It is legal to call this function in any thread.

See Also

sockaddr_to_string2