BSD IPC Utilities

BSD IPC utilities are used for the following purposes:

DManipulate and return information on the following database files: /etc/hosts,

/etc/networks, /etc/protocols, and /etc/services.

DObtain the socket address of the local and peer sockets.

DManipulate Internet (IP) addresses and ASCII strings that represent IP addresses in Internet •dot" notation.

DConvert bytes from network order to host order and vice versa. (HP 1000, HP 9000, and TCP/IP protocols all use network order. These functions are provided for portability.)

The utilities are summarized here in alphabetical order for easy referencing.

Special Considerations

In order to successfully use the BSD IPC utilities, you must be aware of the following:

DThe /ETC directory must be created before you run the BSD IPC utilities.

DMost of the utilities return pointers to structures that are dynamically allocated. If any of these functions that allocate dynamic memory are called repeatedly without freeing the allocated memory, they will eventually fail and return a null pointer.

The BSD IPC utility functions that allocate dynamic memory include:

gethostbyaddr

getnetbyaddr

getprotobyname

getservbyname

gethostbyname

getnetbyname

getprotobynumber

getservbyport

gethostent

getnetent

getprotent

getservent

 

 

 

inet_ntoa

In order to release space that has been dynamically allocated by the above utility functions, use free() from the standard C library (generally found in HPC.LIB).

endhostent()

Closes the /etc/hosts file.

result = endhostent()

int

result

result

0 if the call is successful.

 

-1if a failure occurs.

Berkeley Software Distribution Interprocess Communication 421