summaryrefslogtreecommitdiff
path: root/docs/man/nng_socket_proto_name.3.adoc
blob: da2f565f109fbc22eeac313f82c5d7b64c9ef89b (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
= nng_socket_proto_name(3)
//
// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech>
//
// This document is supplied under the terms of the MIT License, a
// copy of which should be located in the distribution where this
// file was obtained (LICENSE.txt).  A copy of the license may also be
// found online at https://opensource.org/licenses/MIT.
//

== NAME

nng_socket_proto_name - obtain the socket protocol name

== SYNOPSIS

[source, c]
----
#include <nng/nng.h>

int nng_socket_proto_name(nng_socket s, const char **name);
int nng_socket_peer_name(nng_socket s, const char **name);
----

== DESCRIPTION

These functions store the protocol name of either the socket _s_,
or its natural peer, in _name.

NOTE: The string value obtained by these functions is statically stored
as part of the program text, and must not be freed or modified.

TIP: These functions should be used in place of the `NNG_OPT_PROTONAME` and `NNG_OPT_PEERNAME`
options in new code.

== RETURN VALUES

These functions return zero on success, or an error if the socket is invalid.

== ERRORS

[horizontal]
`NNG_ECLOSED`:: Parameter _s_ does not refer to an open socket.

== SEE ALSO

[.text-left]
xref:nng_socket.5.adoc[nng_socket(5)],
xref:nng.7.adoc[nng(7)]