doompanning/docs/man/nng_sockaddr_in.5.adoc
oxmox 17f68cf8fe Squashed 'external/nng/' content from commit 169221da
git-subtree-dir: external/nng
git-subtree-split: 169221da8d53b2ca4fda76f894bee8505887a7c6
2023-02-03 21:18:59 +01:00

71 lines
2 KiB
Text

= nng_sockaddr_in(5)
//
// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// 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_sockaddr_in - IPv4 socket address
== SYNOPSIS
[source, c]
----
#include <nng/nng.h>
enum sockaddr_family {
NNG_AF_INET = 3,
};
typedef struct {
uint16_t sa_family;
uint16_t sa_port;
uint32_t sa_addr;
} nng_sockaddr_in;
----
== DESCRIPTION
(((socket, address, IPv4)))
An `nng_sockaddr_in` is the flavor of xref:nng_sockaddr.5.adoc[`nng_sockaddr`]
used to represent TCP (and sometimes UDP) addresses,
including the Internet Protocol (IP) address and port number.(((port number, TCP)))
This structure is used with IPv4 addresses.
A different structure, xref:nng_sockaddr_in6.5.adoc[`nng_sockaddr_in6`], is used
for IPv6 addresses.
The following structure members are present:
`sa_family`::
This field will always have the value ((`NNG_AF_INET`)).
`sa_port`::
This field holds the TCP or UDP port number, in network byte-order.
A zero value here is used when no specific port number is indicated.
`sa_addr`::
This field holds the ((IP address))(((address, IPv4))) in
network-byte order.
TIP: The `sa_port` and `sa_addr` fields are in network-byte order to
facilitate their use with system APIs such as `inet_ntop()`.
Most platforms use some form of BSD-derived network API, which uses
network-byte order in the various structures (such as `sockaddr_in`).
IMPORTANT: This field appears similar to BSD `sockaddr_in`, but it is
_not_ the same, and they may not be used interchangeably.
== SEE ALSO
[.text-left]
xref:nng_sockaddr.5.adoc[nng_sockaddr(5)],
xref:nng_sockaddr_in6.5.adoc[nng_sockaddr_in6(5)],
xref:nng_tcp.7.adoc[nng_tcp(7)],
xref:nng.7.adoc[nng(7)]