'\" t
.\"     Title: nng_str_sockaddr
.\"    Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.23
.\"      Date: 2025-02-02
.\"    Manual: NNG Reference Manual
.\"    Source: \ \&
.\"  Language: English
.\"
.TH "NNG_STR_SOCKADDR" "3" "2025-02-02" "\ \&" "NNG Reference Manual"
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.ss \n[.ss] 0
.nh
.ad l
.de URL
\fI\\$2\fP <\\$1>\\$3
..
.als MTO URL
.if \n[.g] \{\
.  mso www.tmac
.  am URL
.    ad l
.  .
.  am MTO
.    ad l
.  .
.  LINKSTYLE blue R < >
.\}
.SH "NAME"
nng_str_sockaddr \- get string representation of socket address
.SH "SYNOPSIS"
.sp
.if n .RS 4
.nf
.fam C
#include <nng/nng.h>

#define NNG_MAXADDRSTRLEN (NNG_MAXADDRLEN+16)
const char *nng_str_sockaddr(const nng_sockaddr *sa, char *buf, size_t bufsz)
.fam
.fi
.if n .RE
.SH "DESCRIPTION"
.sp
The \f(CRnng_str_sockaddr()\fP is used to provide a displayable representation
for the socket address \fIsa\fP.
The content will be stored the location provided by \fIbuf\fP, and will be
formatted to fit within \fIbufsz\fP bytes, truncating if necessary.
.sp
As long as \fIbufsz\fP is greater than zero, the result will be properly
zero\-terminated in the usual fashion.
.sp
The \f(CRNNG_MAXADDRSTRLEN\fP can be used to provide a buffer large enough to hold most socket addresses.
It is possible for applications to use very much larger socket addresses (using very long paths
for IPC or inproc), but such addresses are not generally compatible with other implementations,
and will be truncated here.
.SH "RETURN VALUES"
.sp
This function returns the \fIbuf\fP argument.
.SH "ERRORS"
.sp
None.
.SH "SEE ALSO"
.sp
nng_sockaddr(5)