getservent()

Reads the next line of the /etc/services file and returns information on the service.

service = getservent()

struct servent

*service;

service

Pointer to a servent structure that contains service

 

information returned by getservent().

 

The servent structure is defined in the include files

 

<netdb.h>, SOCKET.PASI, and SOCKET.FTNI, for C,

 

Pascal, and FORTRAN programs, respectively.

getsockname()

Returns the socket address of the specified local socket.

result = getsockname (socket, addr, addrlen)

int

result, socket, *addrlen;

struct sockaddr_in *addr;

result

0 if the call is successful.

 

-1if a failure occurs.

socket

Socket descriptor of a local socket.

addr

Pointer to a socket address variable to contain the address of

 

the specified socket. The socket address should be of

 

sockaddr_in type.

 

On return, the socket address structure will contain the local

 

socket address information.

addrlen

Pointer to an integer variable that contains the length, in bytes,

 

of the address structure specified by addr (for example, length

 

of structure sockaddr_in, which is 16 bytes).

On return, it is the pointer to an integer that contains the actual length of the socket address returned in addr. If addr does not point to enough space to contain the whole address of the socket, only the first addrlen bytes of the address are returned.

htonl()

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

netlong = htonl(hostlong)

u_long netlong, hostlong;

netlong

32bit integer in network order, returned by htonl().

hostlong

32bit integer in host order.

428 Berkeley Software Distribution Interprocess Communication