rpc_$use_family_wk Library Routine

Purpose

Creates a socket with a well-known port for a Remote Procedure Call (RPC) server.

Syntax

void rpc_$use_family_wk ( family,  if_spec sockaddr,  slength,  status)
unsigned long family;
rpc_$if_spec_t *if_spec;
socket_$addr_t *sockaddr;
unsigned long *slength;
status_$t *status;

Description

The rpc_$use_family_wk routine creates a socket that uses the port specified with the if_spec parameter. Use this routine to create a socket if a server must listen on a particular well-known port. Otherwise, create the socket with the rpc_$use_family routine.

A server can listen on more than one socket. However, a server normally does not listen on more than one socket for each address family, regardless of the number of interfaces that it exports. Therefore, most servers that use well-known ports should make this call once for each supported address family.

Note: This routine is used by servers only.

Parameters

Input

Item Description
family Specifies the address family of the socket to be created. This value corresponds to the communications protocol used to access the socket and determines how the socket address (sockaddr) parameter is expressed.
if_spec Points to the interface that will be registered by the server. The well-known port is specified as an interface attribute.

Output

Item Description
sockaddr Points to the socket address of the socket on which the server listens.
slength Points to the length, in bytes, of the socket address (sockaddr) parameter.
status Points to the completion status.

Return Values

The rpc_$use_family_wk routine fails if one of the following is true:

Value Description
rpc_$cant_create_sock The RPC runtime library is unable to create a socket.
rpc_$cant_bind_sock The RPC runtime library created a socket but is unable to bind it to a socket address.
rpc_$too_many_sockets The server is trying to use more than the maximum number of sockets allowed. The server has called the rpc_$use_family or rpc_$use_family_wk routines too many times.
rpc_$addr_in_use The specified address and port are already in use. This is caused by multiple calls to the rpc_$use_family_wk routine with the same well-known port.

Examples

To create a well-known socket for an array processor server, enter:

rpc_$use_family_wk (socket_$internet, &matrix_$if_spec,
&sockaddr, slen, &st);