htons()

Converts a 16bit quantity from host order to network order.

netshort = htons(hostshort)

u_short netshort, hostshort;

netshort

16bit integer in network order, returned by htons().

hostshort

16bit integer in host order.

inet_addr()

Interprets character strings representing numbers in the Internet standard •dot" notation, and returns numbers suitable for use as Internet (IP) addresses.

IPaddr = inet_addr(string)

struct in_addr IPaddr;

char*string;

IPaddr

Internet (IP) address returned by inet_addr().

string

Pointer to a character string representing numbers expressed in

 

the Internet standard •dot" notation, such as: •192.41.233.2".

 

Terminate the string with the character \0.

inet_lnaof()

Breaks apart an IP address and returns the node address portion of the IP address.

node = inet_lnaof(IPaddr)

u_long node; struct in_addr IPaddr;

node

Node address portion of the IP address returned by

 

inet_lnaof().

IPaddr

IP address of a host. IP addresses for the Internet family are

 

stored in an address variable of type in_addr.

Berkeley Software Distribution Interprocess Communication 429