Sortix volatile manual
This manual documents Sortix volatile, a development build that has not been officially released. You can instead view this document in the latest official manual.
NAME
inet — internet protocol familySYNOPSIS
#include <sys/socket.h>#include <netinet/in.h>
#define AF_INET 1
typedef uint16_t sa_family_t; typedef uint16_t in_port_t; typedef uint32_t in_addr_t; struct in_addr { in_addr_t s_addr; }; struct sockaddr_in { sa_family_t sin_family; in_port_t sin_port; struct in_addr sin_addr; };
DESCRIPTION
The Internet Protocol version 4 protocol family is a set of protocols using the Internet Protocol version 4 ip(4) as the network layer. SOCK_STREAM sockets are provided by the Transmission Control Protocol tcp(4). SOCK_DGRAM sockets are provided by the User Datagram Protocol udp(4).0
(converted to network byte order) to request bind(2) allocate a port. Port 0
is not valid as a destination port.EXAMPLES
This example manually constructs and deconstructs a struct inaddr_in.struct sockaddr_in saddr; memset(&saddr, 0, sizeof(saddr)); saddr.sin_family = AF_INET; saddr.sin_addr.s_addr = htobe32(0xC0000201); /* 192.0.2.1 */ saddr.sin_port = htobe16(1234); sa_family_t family = saddr.sin_family; in_addr_t addr = be32toh(saddr.sin_addr.s_addr); in_port_t port = be16toh(saddr.sin_port);