posix-next API 0.1.0
Out-of-tree Zephyr POSIX module
Loading...
Searching...
No Matches
POSIX_NETWORKING

POSIX Networking option group. More...

Files

file  inet.h
 Internet address conversion functions (<arpa/inet.h>)
 
file  if.h
 Network interface names and indices (<net/if.h>)
 
file  netdb.h
 POSIX network database operations (<netdb.h>)
 
file  in.h
 Internet address types (<netinet/in.h>)
 
file  tcp.h
 TCP definitions (<netinet/tcp.h>)
 
file  socket.h
 POSIX socket API (<sys/socket.h>)
 

Macros

#define NI_MAXSERV   32
 Reasonable buffer size for getnameinfo() service names.
 
#define EAI_BADFLAGS   DNS_EAI_BADFLAGS
 Flags argument to getaddrinfo() contained an invalid value.
 
#define EAI_NONAME   DNS_EAI_NONAME
 The name does not resolve for the supplied parameters.
 
#define EAI_AGAIN   DNS_EAI_AGAIN
 Temporary failure in name resolution.
 
#define EAI_FAIL   DNS_EAI_FAIL
 Non-recoverable failure in name resolution.
 
#define EAI_NODATA   DNS_EAI_NODATA
 The requested name is valid but has no address data.
 
#define EAI_MEMORY   DNS_EAI_MEMORY
 Memory allocation failure.
 
#define EAI_SYSTEM   DNS_EAI_SYSTEM
 A system error occurred; errno is set.
 
#define EAI_SERVICE   DNS_EAI_SERVICE
 Requested service not available for the given socket type.
 
#define EAI_SOCKTYPE   DNS_EAI_SOCKTYPE
 Socket type not supported.
 
#define EAI_FAMILY   DNS_EAI_FAMILY
 Address family not supported.
 
#define EAI_OVERFLOW   DNS_EAI_OVERFLOW
 Output buffer overflow.
 
#define addrinfo   zsock_addrinfo
 Address info structure (alias for zsock_addrinfo).
 
#define SHUT_RD   ZSOCK_SHUT_RD
 Shut down the read half of the connection.
 
#define SHUT_WR   ZSOCK_SHUT_WR
 Shut down the write half of the connection.
 
#define SHUT_RDWR   ZSOCK_SHUT_RDWR
 Shut down both halves of the connection.
 
#define MSG_PEEK   ZSOCK_MSG_PEEK
 Peek at incoming data without removing it from the queue.
 
#define MSG_TRUNC   ZSOCK_MSG_TRUNC
 Return the real length of the datagram even if it was truncated.
 
#define MSG_DONTWAIT   ZSOCK_MSG_DONTWAIT
 Enable non-blocking operation for this call only.
 
#define MSG_WAITALL   ZSOCK_MSG_WAITALL
 Block until all requested data has been received.
 

Typedefs

typedef uint32_t in_addr_t
 Unsigned 32-bit IPv4 address (alias for in_addr_t).
 
typedef uint16_t in_port_t
 Unsigned 16-bit Internet port number.
 
typedef uint32_t in_addr_t
 Unsigned 32-bit IPv4 address.
 
typedef uint32_t socklen_t
 Type for socket address length values.
 

Functions

in_addr_t inet_addr (const char *cp)
 Convert an IPv4 address from dotted-decimal text to binary.
 
char * inet_ntoa (struct in_addr in)
 Convert an IPv4 address from binary to dotted-decimal text.
 
char * inet_ntop (sa_family_t family, const void *src, char *dst, size_t size)
 Convert an IPv4 or IPv6 address from binary to text form.
 
int inet_pton (sa_family_t family, const char *src, void *dst)
 Convert an IPv4 or IPv6 address from text form to binary.
 
char * if_indextoname (unsigned int ifindex, char *ifname)
 Map a network interface index to its name.
 
void if_freenameindex (struct if_nameindex *ptr)
 Free a list returned by if_nameindex().
 
struct if_nameindexif_nameindex (void)
 Return all network interfaces as a name-index array.
 
unsigned int if_nametoindex (const char *ifname)
 Map a network interface name to its index.
 
void endhostent (void)
 Close the hosts database (legacy, no-op on most systems).
 
void endnetent (void)
 Close the networks database (legacy, no-op on most systems).
 
void endprotoent (void)
 Close the protocols database (legacy).
 
void endservent (void)
 Close the services database (legacy).
 
void freeaddrinfo (struct zsock_addrinfo *ai)
 Free addrinfo list returned by getaddrinfo().
 
const char * gai_strerror (int errcode)
 Return a string describing a getaddrinfo() error code.
 
int getaddrinfo (const char *host, const char *service, const struct zsock_addrinfo *hints, struct zsock_addrinfo **res)
 Translate a hostname and service to a list of socket addresses.
 
struct hostentgethostent (void)
 Get the next entry from the hosts database (legacy, sequential).
 
int getnameinfo (const struct sockaddr *addr, socklen_t addrlen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, int flags)
 Translate a socket address to a hostname and service name.
 
struct netentgetnetbyaddr (uint32_t net, int type)
 Look up a network by address (legacy).
 
struct netentgetnetbyname (const char *name)
 Look up a network by name (legacy).
 
struct netentgetnetent (void)
 Get the next entry from the networks database (legacy, sequential).
 
struct protoentgetprotobyname (const char *name)
 Look up a protocol by name (legacy).
 
struct protoentgetprotobynumber (int proto)
 Look up a protocol by number (legacy).
 
struct protoentgetprotoent (void)
 Get the next entry from the protocols database (legacy, sequential).
 
struct serventgetservbyname (const char *name, const char *proto)
 Look up a service by name and protocol (legacy).
 
struct serventgetservbyport (int port, const char *proto)
 Look up a service by port number and protocol (legacy).
 
struct serventgetservent (void)
 Get the next entry from the services database (legacy, sequential).
 
void sethostent (int stayopen)
 Open the hosts database (legacy).
 
void setnetent (int stayopen)
 Open the networks database (legacy).
 
void setprotoent (int stayopen)
 Open the protocols database (legacy).
 
void setservent (int stayopen)
 Open the services database (legacy).
 
int accept (int sock, struct sockaddr *addr, socklen_t *addrlen)
 Accept a new connection on a listening socket.
 
int bind (int sock, const struct sockaddr *addr, socklen_t addrlen)
 Assign a local address to a socket.
 
int connect (int sock, const struct sockaddr *addr, socklen_t addrlen)
 Initiate a connection on a socket.
 
int getpeername (int sock, struct sockaddr *addr, socklen_t *addrlen)
 Get the address of the peer connected to a socket.
 
int getsockname (int sock, struct sockaddr *addr, socklen_t *addrlen)
 Get the local address bound to a socket.
 
int getsockopt (int sock, int level, int optname, void *optval, socklen_t *optlen)
 Get socket options.
 
int listen (int sock, int backlog)
 Mark a socket as passive (ready to accept connections).
 
ssize_t recv (int sock, void *buf, size_t max_len, int flags)
 Receive data from a connected socket.
 
ssize_t recvfrom (int sock, void *buf, size_t max_len, int flags, struct sockaddr *src_addr, socklen_t *addrlen)
 Receive data and the sender's address from a socket.
 
ssize_t recvmsg (int sock, struct msghdr *msg, int flags)
 Receive a message (with scatter-gather I/O and ancillary data).
 
ssize_t send (int sock, const void *buf, size_t len, int flags)
 Send data on a connected socket.
 
ssize_t sendmsg (int sock, const struct msghdr *message, int flags)
 Send a message (with scatter-gather I/O and ancillary data).
 
ssize_t sendto (int sock, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen)
 Send data to a specific destination address.
 
int setsockopt (int sock, int level, int optname, const void *optval, socklen_t optlen)
 Set socket options.
 
int shutdown (int sock, int how)
 Shut down part or all of a full-duplex connection.
 
int sockatmark (int s)
 Determine whether a socket is at the out-of-band mark.
 
int socket (int family, int type, int proto)
 Create a new socket.
 
int socketpair (int family, int type, int proto, int sv[2])
 Create a pair of connected sockets.
 

Detailed Description

POSIX Networking option group.

Macro Definition Documentation

◆ addrinfo

#define addrinfo   zsock_addrinfo

Address info structure (alias for zsock_addrinfo).

Definition at line 90 of file netdb.h.

◆ EAI_AGAIN

#define EAI_AGAIN   DNS_EAI_AGAIN

Temporary failure in name resolution.

Definition at line 35 of file netdb.h.

◆ EAI_BADFLAGS

#define EAI_BADFLAGS   DNS_EAI_BADFLAGS

Flags argument to getaddrinfo() contained an invalid value.

Definition at line 31 of file netdb.h.

◆ EAI_FAIL

#define EAI_FAIL   DNS_EAI_FAIL

Non-recoverable failure in name resolution.

Definition at line 37 of file netdb.h.

◆ EAI_FAMILY

#define EAI_FAMILY   DNS_EAI_FAMILY

Address family not supported.

Definition at line 49 of file netdb.h.

◆ EAI_MEMORY

#define EAI_MEMORY   DNS_EAI_MEMORY

Memory allocation failure.

Definition at line 41 of file netdb.h.

◆ EAI_NODATA

#define EAI_NODATA   DNS_EAI_NODATA

The requested name is valid but has no address data.

Definition at line 39 of file netdb.h.

◆ EAI_NONAME

#define EAI_NONAME   DNS_EAI_NONAME

The name does not resolve for the supplied parameters.

Definition at line 33 of file netdb.h.

◆ EAI_OVERFLOW

#define EAI_OVERFLOW   DNS_EAI_OVERFLOW

Output buffer overflow.

Definition at line 51 of file netdb.h.

◆ EAI_SERVICE

#define EAI_SERVICE   DNS_EAI_SERVICE

Requested service not available for the given socket type.

Definition at line 45 of file netdb.h.

◆ EAI_SOCKTYPE

#define EAI_SOCKTYPE   DNS_EAI_SOCKTYPE

Socket type not supported.

Definition at line 47 of file netdb.h.

◆ EAI_SYSTEM

#define EAI_SYSTEM   DNS_EAI_SYSTEM

A system error occurred; errno is set.

Definition at line 43 of file netdb.h.

◆ MSG_DONTWAIT

#define MSG_DONTWAIT   ZSOCK_MSG_DONTWAIT

Enable non-blocking operation for this call only.

Definition at line 38 of file socket.h.

◆ MSG_PEEK

#define MSG_PEEK   ZSOCK_MSG_PEEK

Peek at incoming data without removing it from the queue.

Definition at line 34 of file socket.h.

◆ MSG_TRUNC

#define MSG_TRUNC   ZSOCK_MSG_TRUNC

Return the real length of the datagram even if it was truncated.

Definition at line 36 of file socket.h.

◆ MSG_WAITALL

#define MSG_WAITALL   ZSOCK_MSG_WAITALL

Block until all requested data has been received.

Definition at line 40 of file socket.h.

◆ NI_MAXSERV

#define NI_MAXSERV   32

Reasonable buffer size for getnameinfo() service names.

Definition at line 27 of file netdb.h.

◆ SHUT_RD

#define SHUT_RD   ZSOCK_SHUT_RD

Shut down the read half of the connection.

Definition at line 27 of file socket.h.

◆ SHUT_RDWR

#define SHUT_RDWR   ZSOCK_SHUT_RDWR

Shut down both halves of the connection.

Definition at line 31 of file socket.h.

◆ SHUT_WR

#define SHUT_WR   ZSOCK_SHUT_WR

Shut down the write half of the connection.

Definition at line 29 of file socket.h.

Typedef Documentation

◆ in_addr_t [1/2]

typedef uint32_t in_addr_t

Unsigned 32-bit IPv4 address (alias for in_addr_t).

Definition at line 32 of file inet.h.

◆ in_addr_t [2/2]

typedef uint32_t in_addr_t

Unsigned 32-bit IPv4 address.

Definition at line 35 of file in.h.

◆ in_port_t

typedef uint16_t in_port_t

Unsigned 16-bit Internet port number.

Definition at line 32 of file in.h.

◆ socklen_t

typedef uint32_t socklen_t

Type for socket address length values.

Definition at line 48 of file socket.h.

Function Documentation

◆ accept()

int accept ( int  sock,
struct sockaddr *  addr,
socklen_t addrlen 
)

Accept a new connection on a listening socket.

Parameters
sockListening socket file descriptor.
addrOutput: address of the connecting peer, or NULL.
addrlenInput: size of addr; output: actual address size.
Returns
New socket file descriptor on success, or -1 on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html

◆ bind()

int bind ( int  sock,
const struct sockaddr *  addr,
socklen_t  addrlen 
)

Assign a local address to a socket.

Parameters
sockSocket file descriptor.
addrLocal address to bind.
addrlenSize of addr in bytes.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html

◆ connect()

int connect ( int  sock,
const struct sockaddr *  addr,
socklen_t  addrlen 
)

Initiate a connection on a socket.

Parameters
sockSocket file descriptor.
addrRemote address to connect to.
addrlenSize of addr in bytes.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html

◆ endhostent()

void endhostent ( void  )

Close the hosts database (legacy, no-op on most systems).

◆ endnetent()

void endnetent ( void  )

Close the networks database (legacy, no-op on most systems).

◆ endprotoent()

void endprotoent ( void  )

Close the protocols database (legacy).

◆ endservent()

void endservent ( void  )

Close the services database (legacy).

◆ freeaddrinfo()

void freeaddrinfo ( struct zsock_addrinfo *  ai)

Free addrinfo list returned by getaddrinfo().

Parameters
aiLinked list to free.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/freeaddrinfo.html

◆ gai_strerror()

const char * gai_strerror ( int  errcode)

Return a string describing a getaddrinfo() error code.

Parameters
errcodeError code returned by getaddrinfo().
Returns
Pointer to a description string.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/gai_strerror.html

◆ getaddrinfo()

int getaddrinfo ( const char *  host,
const char *  service,
const struct zsock_addrinfo *  hints,
struct zsock_addrinfo **  res 
)

Translate a hostname and service to a list of socket addresses.

Parameters
hostHostname or numeric address string, or NULL.
serviceService name or numeric port string, or NULL.
hintsCriteria for address selection, or NULL for defaults.
resOutput: linked list of matching addresses.
Returns
0 on success, or a non-zero EAI_* error code.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html

◆ gethostent()

struct hostent * gethostent ( void  )

Get the next entry from the hosts database (legacy, sequential).

Returns
Pointer to a static hostent on success, or NULL at end or on error.

◆ getnameinfo()

int getnameinfo ( const struct sockaddr *  addr,
socklen_t  addrlen,
char *  host,
socklen_t  hostlen,
char *  serv,
socklen_t  servlen,
int  flags 
)

Translate a socket address to a hostname and service name.

Parameters
addrSocket address to look up.
addrlenSize of addr.
hostOutput buffer for the hostname, or NULL.
hostlenSize of host.
servOutput buffer for the service name, or NULL.
servlenSize of serv.
flagsNI_* flags controlling the conversion.
Returns
0 on success, or a non-zero EAI_* error code.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getnameinfo.html

◆ getnetbyaddr()

struct netent * getnetbyaddr ( uint32_t  net,
int  type 
)

Look up a network by address (legacy).

Parameters
netNetwork number (host byte order).
typeAddress type (AF_INET).
Returns
Pointer to a static netent, or NULL on failure.

◆ getnetbyname()

struct netent * getnetbyname ( const char *  name)

Look up a network by name (legacy).

Parameters
nameNetwork name.
Returns
Pointer to a static netent, or NULL on failure.

◆ getnetent()

struct netent * getnetent ( void  )

Get the next entry from the networks database (legacy, sequential).

Returns
Pointer to a static netent, or NULL at end or on error.

◆ getpeername()

int getpeername ( int  sock,
struct sockaddr *  addr,
socklen_t addrlen 
)

Get the address of the peer connected to a socket.

Parameters
sockSocket file descriptor.
addrOutput: peer address.
addrlenInput: size of addr; output: actual size.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html

◆ getprotobyname()

struct protoent * getprotobyname ( const char *  name)

Look up a protocol by name (legacy).

Parameters
nameProtocol name (e.g. "tcp").
Returns
Pointer to a static protoent, or NULL on failure.

◆ getprotobynumber()

struct protoent * getprotobynumber ( int  proto)

Look up a protocol by number (legacy).

Parameters
protoProtocol number.
Returns
Pointer to a static protoent, or NULL on failure.

◆ getprotoent()

struct protoent * getprotoent ( void  )

Get the next entry from the protocols database (legacy, sequential).

Returns
Pointer to a static protoent, or NULL at end or on error.

◆ getservbyname()

struct servent * getservbyname ( const char *  name,
const char *  proto 
)

Look up a service by name and protocol (legacy).

Parameters
nameService name (e.g. "http").
protoProtocol ("tcp", "udp", or NULL for any).
Returns
Pointer to a static servent, or NULL on failure.

◆ getservbyport()

struct servent * getservbyport ( int  port,
const char *  proto 
)

Look up a service by port number and protocol (legacy).

Parameters
portPort number (network byte order).
protoProtocol ("tcp", "udp", or NULL for any).
Returns
Pointer to a static servent, or NULL on failure.

◆ getservent()

struct servent * getservent ( void  )

Get the next entry from the services database (legacy, sequential).

Returns
Pointer to a static servent, or NULL at end or on error.

◆ getsockname()

int getsockname ( int  sock,
struct sockaddr *  addr,
socklen_t addrlen 
)

Get the local address bound to a socket.

Parameters
sockSocket file descriptor.
addrOutput: local address.
addrlenInput: size of addr; output: actual size.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html

◆ getsockopt()

int getsockopt ( int  sock,
int  level,
int  optname,
void *  optval,
socklen_t optlen 
)

Get socket options.

Parameters
sockSocket file descriptor.
levelProtocol level (SOL_SOCKET, IPPROTO_TCP, etc.).
optnameOption name (SO_REUSEADDR, SO_KEEPALIVE, etc.).
optvalOutput: option value.
optlenInput: size of optval; output: actual size.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html

◆ if_freenameindex()

void if_freenameindex ( struct if_nameindex ptr)

Free a list returned by if_nameindex().

Parameters
ptrList to free (must have been returned by if_nameindex()).
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/if_freenameindex.html

◆ if_indextoname()

char * if_indextoname ( unsigned int  ifindex,
char *  ifname 
)

Map a network interface index to its name.

Parameters
ifindexNumeric interface index.
ifnameOutput buffer of at least IF_NAMESIZE bytes.
Returns
ifname on success, or NULL with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/if_indextoname.html

◆ if_nameindex()

struct if_nameindex * if_nameindex ( void  )

Return all network interfaces as a name-index array.

The returned array is terminated by an entry with if_index == 0 and if_name == NULL. Free with if_freenameindex().

Returns
Allocated array on success, or NULL with errno set on failure.

◆ if_nametoindex()

unsigned int if_nametoindex ( const char *  ifname)

Map a network interface name to its index.

Parameters
ifnameInterface name string.
Returns
Interface index on success, or 0 with errno set on failure.

◆ inet_addr()

in_addr_t inet_addr ( const char *  cp)

Convert an IPv4 address from dotted-decimal text to binary.

Note
Deprecated; use inet_pton() for new code.
Parameters
cpDotted-decimal IPv4 address string (e.g. "192.0.2.1").
Returns
IPv4 address in network byte order, or INADDR_NONE on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_addr.html

◆ inet_ntoa()

char * inet_ntoa ( struct in_addr  in)

Convert an IPv4 address from binary to dotted-decimal text.

Note
Deprecated; use inet_ntop() for new code. The returned pointer is to a static buffer that may be overwritten by subsequent calls.
Parameters
inIPv4 address in network byte order.
Returns
Pointer to a dotted-decimal string, or NULL on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_ntoa.html

◆ inet_ntop()

char * inet_ntop ( sa_family_t  family,
const void *  src,
char *  dst,
size_t  size 
)

Convert an IPv4 or IPv6 address from binary to text form.

Parameters
familyAddress family: AF_INET or AF_INET6.
srcSource address in network byte order.
dstOutput buffer for the text form.
sizeSize of dst in bytes (INET_ADDRSTRLEN / INET6_ADDRSTRLEN).
Returns
dst on success, or NULL with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_ntop.html

◆ inet_pton()

int inet_pton ( sa_family_t  family,
const char *  src,
void *  dst 
)

Convert an IPv4 or IPv6 address from text form to binary.

Parameters
familyAddress family: AF_INET or AF_INET6.
srcText form of the address.
dstOutput buffer for the binary address.
Returns
1 on success, 0 if src is not a valid address, -1 on error.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_pton.html

◆ listen()

int listen ( int  sock,
int  backlog 
)

Mark a socket as passive (ready to accept connections).

Parameters
sockSocket file descriptor.
backlogMaximum number of pending connections to queue.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html

◆ recv()

ssize_t recv ( int  sock,
void *  buf,
size_t  max_len,
int  flags 
)

Receive data from a connected socket.

Parameters
sockSocket file descriptor.
bufBuffer to receive data into.
max_lenMaximum number of bytes to receive.
flagsMSG_* flags (MSG_PEEK, MSG_DONTWAIT, etc.).
Returns
Number of bytes received, 0 on connection closed, or -1 on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html

◆ recvfrom()

ssize_t recvfrom ( int  sock,
void *  buf,
size_t  max_len,
int  flags,
struct sockaddr *  src_addr,
socklen_t addrlen 
)

Receive data and the sender's address from a socket.

Parameters
sockSocket file descriptor.
bufBuffer to receive data into.
max_lenMaximum number of bytes to receive.
flagsMSG_* flags.
src_addrOutput: sender's address, or NULL.
addrlenInput: size of src_addr; output: actual size.
Returns
Number of bytes received on success, or -1 on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html

◆ recvmsg()

ssize_t recvmsg ( int  sock,
struct msghdr *  msg,
int  flags 
)

Receive a message (with scatter-gather I/O and ancillary data).

Parameters
sockSocket file descriptor.
msgMessage header specifying I/O vectors and address buffer.
flagsMSG_* flags.
Returns
Number of bytes received on success, or -1 on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvmsg.html

◆ send()

ssize_t send ( int  sock,
const void *  buf,
size_t  len,
int  flags 
)

Send data on a connected socket.

Parameters
sockSocket file descriptor.
bufData to send.
lenNumber of bytes to send.
flagsMSG_* flags (MSG_DONTWAIT, MSG_NOSIGNAL, etc.).
Returns
Number of bytes sent on success, or -1 on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html

◆ sendmsg()

ssize_t sendmsg ( int  sock,
const struct msghdr *  message,
int  flags 
)

Send a message (with scatter-gather I/O and ancillary data).

Parameters
sockSocket file descriptor.
messageMessage header specifying I/O vectors and destination.
flagsMSG_* flags.
Returns
Number of bytes sent on success, or -1 on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html

◆ sendto()

ssize_t sendto ( int  sock,
const void *  buf,
size_t  len,
int  flags,
const struct sockaddr *  dest_addr,
socklen_t  addrlen 
)

Send data to a specific destination address.

Parameters
sockSocket file descriptor.
bufData to send.
lenNumber of bytes to send.
flagsMSG_* flags.
dest_addrDestination address.
addrlenSize of dest_addr in bytes.
Returns
Number of bytes sent on success, or -1 on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html

◆ sethostent()

void sethostent ( int  stayopen)

Open the hosts database (legacy).

Parameters
stayopenNon-zero to keep the database connection open.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sethostent.html

◆ setnetent()

void setnetent ( int  stayopen)

Open the networks database (legacy).

Parameters
stayopenNon-zero to keep the database connection open.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/setnetent.html

◆ setprotoent()

void setprotoent ( int  stayopen)

Open the protocols database (legacy).

Parameters
stayopenNon-zero to keep the database connection open.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/setprotoent.html

◆ setservent()

void setservent ( int  stayopen)

Open the services database (legacy).

Parameters
stayopenNon-zero to keep the database connection open.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/setservent.html

◆ setsockopt()

int setsockopt ( int  sock,
int  level,
int  optname,
const void *  optval,
socklen_t  optlen 
)

Set socket options.

Parameters
sockSocket file descriptor.
levelProtocol level (SOL_SOCKET, IPPROTO_TCP, etc.).
optnameOption name.
optvalPointer to the new option value.
optlenSize of optval in bytes.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html

◆ shutdown()

int shutdown ( int  sock,
int  how 
)

Shut down part or all of a full-duplex connection.

Parameters
sockSocket file descriptor.
howSHUT_RD, SHUT_WR, or SHUT_RDWR.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/shutdown.html

◆ sockatmark()

int sockatmark ( int  s)

Determine whether a socket is at the out-of-band mark.

Parameters
sSocket file descriptor.
Returns
1 if at the mark, 0 if not, or -1 on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sockatmark.html

◆ socket()

int socket ( int  family,
int  type,
int  proto 
)

Create a new socket.

Parameters
familyProtocol family (AF_INET, AF_INET6, AF_UNIX, etc.).
typeSocket type (SOCK_STREAM, SOCK_DGRAM, SOCK_RAW, etc.).
protoProtocol number (IPPROTO_TCP, IPPROTO_UDP, 0 for default).
Returns
New socket file descriptor on success, or -1 on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html

◆ socketpair()

int socketpair ( int  family,
int  type,
int  proto,
int  sv[2] 
)

Create a pair of connected sockets.

Parameters
familyProtocol family (typically AF_UNIX).
typeSocket type.
protoProtocol.
svOutput: two-element array receiving the socket descriptors.
Returns
0 on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/socketpair.html