posix-next API 0.1.0
Out-of-tree Zephyr POSIX module
Loading...
Searching...
No Matches
POSIX_NETWORKING
Implementation completeness: 100.0%100IMPLLine coverage: 79.0%79COVLinux compatibility tests: passing🐧

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 and constants (<netinet/in.h>)
 
file  tcp.h
 TCP definitions (<netinet/tcp.h>)
 
file  socket.h
 POSIX socket API (<sys/socket.h>)
 
file  un.h
 POSIX UNIX domain socket types (<sys/un.h>)
 

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.
 
void endnetent (void)
 Close the networks database.
 
void endprotoent (void)
 Close the protocols database.
 
void endservent (void)
 Close the services database.
 
void freeaddrinfo (struct 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 addrinfo *hints, struct addrinfo **res)
 Translate a hostname and service to a list of socket addresses.
 
struct hostentgethostent (void)
 Get the next entry from the hosts database.
 
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.
 
struct netentgetnetbyname (const char *name)
 Look up a network by name.
 
struct netentgetnetent (void)
 Get the next entry from the networks database.
 
struct protoentgetprotobyname (const char *name)
 Look up a protocol by name.
 
struct protoentgetprotobynumber (int proto)
 Look up a protocol by number.
 
struct protoentgetprotoent (void)
 Get the next entry from the protocols database.
 
struct serventgetservbyname (const char *name, const char *proto)
 Look up a service by name and protocol.
 
struct serventgetservbyport (int port, const char *proto)
 Look up a service by port number and protocol.
 
struct serventgetservent (void)
 Get the next entry from the services database.
 
void sethostent (int stayopen)
 Open the hosts database.
 
void setnetent (int stayopen)
 Open the networks database.
 
void setprotoent (int stayopen)
 Open the protocols database.
 
void setservent (int stayopen)
 Open the services database.
 
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.
 
int gethostname (char *name, size_t namelen)
 Get the name of the current host.
 

Detailed Description

POSIX Networking option group.

Function Documentation

◆ accept()

int accept ( int  sock,
struct sockaddr addr,
socklen_t *  addrlen 
)
accept line coverage: 92.3%92Linux compatibility tests: passing🐧

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 with errno set 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 
)
bind line coverage: 71.4%71Linux compatibility tests: passing🐧

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 
)
connect line coverage: 71.4%71Linux compatibility tests: passing🐧

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  )
endhostent line coverage: 100.0%100Linux compatibility tests: passing🐧

Close the hosts database.

See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/endhostent.html

◆ endnetent()

void endnetent ( void  )
endnetent line coverage: 100.0%100Linux compatibility tests: passing🐧

Close the networks database.

See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/endnetent.html

◆ endprotoent()

void endprotoent ( void  )
endprotoent line coverage: 100.0%100Linux compatibility tests: passing🐧

Close the protocols database.

See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/endprotoent.html

◆ endservent()

void endservent ( void  )
endservent line coverage: 100.0%100Linux compatibility tests: passing🐧

Close the services database.

See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/endservent.html

◆ freeaddrinfo()

void freeaddrinfo ( struct addrinfo ai)
freeaddrinfo line coverage: 100.0%100Linux compatibility tests: passing🐧

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)
gai_strerror line coverage: 100.0%100Linux compatibility tests: passing🐧

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 addrinfo hints,
struct addrinfo **  res 
)
getaddrinfo line coverage: 100.0%100Linux compatibility tests: passing🐧

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  )
gethostent line coverage: 73.3%73Linux compatibility tests: passing🐧

Get the next entry from the hosts database.

Returns
Pointer to a static hostent on success, or NULL at end or on error.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostent.html

◆ gethostname()

int gethostname ( char *  name,
size_t  namelen 
)
gethostname line coverage: 100.0%100Linux compatibility tests: passing🐧

Get the name of the current host.

See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostname.html

◆ getnameinfo()

int getnameinfo ( const struct sockaddr addr,
socklen_t  addrlen,
char *  host,
socklen_t  hostlen,
char *  serv,
socklen_t  servlen,
int  flags 
)
getnameinfo line coverage: 83.3%83Linux compatibility tests: passing🐧

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 
)
getnetbyaddr line coverage: 75.0%75Linux compatibility tests: passing🐧

Look up a network by address.

Parameters
netNetwork number (host byte order).
typeAddress type (AF_INET).
Returns
Pointer to a static netent, or NULL on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getnetbyaddr.html

◆ getnetbyname()

struct netent * getnetbyname ( const char *  name)
getnetbyname line coverage: 75.0%75Linux compatibility tests: passing🐧

Look up a network by name.

Parameters
nameNetwork name.
Returns
Pointer to a static netent, or NULL on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getnetbyname.html

◆ getnetent()

struct netent * getnetent ( void  )
getnetent line coverage: 73.3%73Linux compatibility tests: passing🐧

Get the next entry from the networks database.

Returns
Pointer to a static netent, or NULL at end or on error.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getnetent.html

◆ getpeername()

int getpeername ( int  sock,
struct sockaddr addr,
socklen_t *  addrlen 
)
getpeername line coverage: 84.6%85Linux compatibility tests: passing🐧

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)
getprotobyname line coverage: 75.0%75Linux compatibility tests: passing🐧

Look up a protocol by name.

Parameters
nameProtocol name (e.g. "tcp").
Returns
Pointer to a static protoent, or NULL on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getprotobyname.html

◆ getprotobynumber()

struct protoent * getprotobynumber ( int  proto)
getprotobynumber line coverage: 100.0%100Linux compatibility tests: passing🐧

Look up a protocol by number.

Parameters
protoProtocol number.
Returns
Pointer to a static protoent, or NULL on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getprotobynumber.html

◆ getprotoent()

struct protoent * getprotoent ( void  )
getprotoent line coverage: 73.3%73Linux compatibility tests: passing🐧

Get the next entry from the protocols database.

Returns
Pointer to a static protoent, or NULL at end or on error.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getprotoent.html

◆ getservbyname()

struct servent * getservbyname ( const char *  name,
const char *  proto 
)
getservbyname line coverage: 75.0%75Linux compatibility tests: passing🐧

Look up a service by name and protocol.

Parameters
nameService name (e.g. "http").
protoProtocol ("tcp", "udp", or NULL for any).
Returns
Pointer to a static servent, or NULL on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getservbyname.html

◆ getservbyport()

struct servent * getservbyport ( int  port,
const char *  proto 
)
getservbyport line coverage: 100.0%100Linux compatibility tests: passing🐧

Look up a service by port number and protocol.

Parameters
portPort number (network byte order).
protoProtocol ("tcp", "udp", or NULL for any).
Returns
Pointer to a static servent, or NULL on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getservbyport.html

◆ getservent()

struct servent * getservent ( void  )
getservent line coverage: 73.3%73Linux compatibility tests: passing🐧

Get the next entry from the services database.

Returns
Pointer to a static servent, or NULL at end or on error.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getservent.html

◆ getsockname()

int getsockname ( int  sock,
struct sockaddr addr,
socklen_t *  addrlen 
)
getsockname line coverage: 84.6%85Linux compatibility tests: passing🐧

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 
)
getsockopt line coverage: 100.0%100Linux compatibility tests: passing🐧

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)
if_freenameindex line coverage: 100.0%100Linux compatibility tests: passing🐧

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 
)
if_indextoname line coverage: 100.0%100Linux compatibility tests: passing🐧

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  )
if_nameindex line coverage: 68.4%68Linux compatibility tests: passing🐧

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.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/if_nameindex.html

◆ if_nametoindex()

unsigned int if_nametoindex ( const char *  ifname)
if_nametoindex line coverage: 80.0%80Linux compatibility tests: passing🐧

Map a network interface name to its index.

Parameters
ifnameInterface name string.
Returns
Interface index on success, or 0 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/if_nametoindex.html

◆ inet_addr()

in_addr_t inet_addr ( const char *  cp)
inet_addr line coverage: 100.0%100Linux compatibility tests: passing🐧

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 (in_addr_t)(-1) on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_addr.html

◆ inet_ntoa()

char * inet_ntoa ( struct in_addr  in)
inet_ntoa line coverage: 100.0%100Linux compatibility tests: passing🐧

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 
)
inet_ntop line coverage: 100.0%100Linux compatibility tests: passing🐧

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 
)
inet_pton line coverage: 100.0%100Linux compatibility tests: passing🐧

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, or -1 with errno set on error.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_pton.html

◆ listen()

int listen ( int  sock,
int  backlog 
)
listen line coverage: 100.0%100Linux compatibility tests: passing🐧

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 
)
recv line coverage: 100.0%100Linux compatibility tests: passing🐧

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_WAITALL, etc.).
Returns
Number of bytes received, 0 on connection closed, or -1 with errno set 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 
)
recvfrom line coverage: 84.6%85Linux compatibility tests: passing🐧

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 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html

◆ recvmsg()

ssize_t recvmsg ( int  sock,
struct msghdr msg,
int  flags 
)
recvmsg line coverage: 88.5%88Linux compatibility tests: passing🐧

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 with errno set 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 line coverage: 100.0%100Linux compatibility tests: passing🐧

Send data on a connected socket.

Parameters
sockSocket file descriptor.
bufData to send.
lenNumber of bytes to send.
flagsMSG_* flags (MSG_OOB, MSG_NOSIGNAL, etc.).
Returns
Number of bytes sent on success, or -1 with errno set 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 
)
sendmsg line coverage: 75.0%75Linux compatibility tests: passing🐧

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 with errno set 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 
)
sendto line coverage: 83.3%83Linux compatibility tests: passing🐧

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 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html

◆ sethostent()

void sethostent ( int  stayopen)
sethostent line coverage: 100.0%100Linux compatibility tests: passing🐧

Open the hosts database.

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)
setnetent line coverage: 100.0%100Linux compatibility tests: passing🐧

Open the networks database.

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)
setprotoent line coverage: 100.0%100Linux compatibility tests: passing🐧

Open the protocols database.

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)
setservent line coverage: 100.0%100Linux compatibility tests: passing🐧

Open the services database.

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 
)
setsockopt line coverage: 100.0%100Linux compatibility tests: passing🐧

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 
)
shutdown line coverage: 100.0%100Linux compatibility tests: passing🐧

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)
sockatmark line coverage: 100.0%100Linux compatibility tests: passing🐧

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 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sockatmark.html

◆ socket()

int socket ( int  family,
int  type,
int  proto 
)
socket line coverage: 100.0%100Linux compatibility tests: passing🐧

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 with errno set 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] 
)
socketpair line coverage: 100.0%100Linux compatibility tests: passing🐧

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