.TH INTERNET 3X .CT 2 comm_mach .SH NAME in_host, in_ntoa, in_address, in_service \- internet networking functions .SH SYNOPSIS .nf .B #include <sys/inet/in.h> .PP .B char *in_host(hostaddr) .B in_addr hostaddr; .PP .B char *in_ntoa(hostaddr) .B in_addr hostaddr; .PP .B in_addr in_address(hostname) .B char *hostname; .PP .B struct in_service *in_service(name, proto, port) .B char *name, *proto; .B unsigned long port; .fi .PP .SH DESCRIPTION These routines are loaded by the .B -lin option of .IR ld (1). .PP Internet addresses, type .I in_addr, are 32-bit quantities global to the network. The .SM ASCII representation of an .I in_addr can be either a host name or of the form .I b1.b2.b3.b4, where each .I `bx' is the value of the .IR x 'th byte of the address in decimal. Since host names are considered local `aliases' for internet addresses, the host-to-address mapping is subjective. .PP .I In_address maps an internet host name to an address and returns 0 if the name is not found in the host table. .PP .I In_host maps an internet address into a host name. If the host is not found in the host table, the .SM ASCII representation of the address is returned. .PP .I In_ntoa maps an internet address to its .SM ASCII numeric format. .PP .I In_service returns the closest match to .I name in the services file. If either .I name or .I port are 0, they will match any name or port. If .I proto is .BR "(char *)0" , the .B tcp protocol is assumed. .SH FILES .nf .ta 32n \fL/usr/inet/lib/hosts\fP mapping between host names and addresses \fL/usr/inet/lib/networks\fP mapping between network names and addresses \fL/usr/inet/lib/services\fP database of services \fL/usr/inet/lib/hosts.equiv\fP machines with common administration .fi .SH SEE ALSO .IR ipc (3), .IR tcp (3), .IR udp (3) .SH BUGS .PP The mappings between internet addresses and names is arbitrary at best. The hosts file may contain many addresses for each name and/or many names for each address. .I In_address and .I in_host each start at the beginning of the file and search sequentially for a match. Therefore, .B "in_addr(in_host(addr)) \=\= addr" is not necessarily true.