INET(4) | Kernel Interfaces Manual | INET(4) |
Sockets bound to the Internet protocol family use the following addressing structure,
struct sockaddr_in { uint8_t sin_len; sa_family_t sin_family; in_port_t sin_port; struct in_addr sin_addr; int8_t sin_zero[8]; };
Sockets may be created with the local address INADDR_ANY to effect “wildcard” matching on incoming messages. The address in a connect(2) or sendto(2) call may be given as INADDR_ANY to mean “this host”. The distinguished address INADDR_BROADCAST is allowed as a shorthand for the broadcast address on the primary network if the first network configured supports broadcast.
The 32-bit Internet address contains both network and host parts. It is frequency-encoded; the most-significant bit is clear in Class A addresses, in which the high-order 8 bits are the network number. Class B addresses use the high-order 16 bits as the network field, and Class C addresses have a 24-bit network part. Sites with a cluster of local networks and a connection to the Internet may chose to use a single network number for the cluster; this is done by using subnet addressing. The local (host) portion of the address is further subdivided into subnet and host parts. Within a subnet, each subnet appears to be an individual network; externally, the entire cluster appears to be a single, uniform network requiring only a single routing entry. Subnet addressing is enabled and examined by the following ioctl(2) commands on a datagram socket in the Internet domain; they have the same form as the SIOCIFADDR command (see netintro(4)).
Stuart Sechrest, An Introductory 4.4BSD Interprocess Communication Tutorial. (see /usr/share/doc/psd/20.ipctut)
Samuel J. Leffler, Robert S. Fabry, William N. Joy, Phil Lapsley, Steve Miller, and Chris Torek, Advanced 4.4BSD IPC Tutorial. (see /usr/share/doc/psd/21.ipc)
May 15, 2003 | NetBSD 6.1 |