[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Communications Technical Reference, Volume 1

rpc_$name_to_sockaddr Library Routine

Purpose

Converts a host name and port number to a socket address.

Syntax

void rpc_$name_to_sockaddr (name, nlength, port, family, sockaddr, slength, status)
char *name;
unsigned long nlength;
unsigned long port;
unsigned long family;
socket_$addr_t *sockaddr;
unsigned long *slength;
status_$t *status;

Description

The rpc_$name_to_sockaddr routine provides the socket address for a socket, given the host name, the port number, and the address family.

You can specify the socket address information either as one text string in the name parameter, or by passing each of the three elements as a separate parameter. When three separate elements are passed, the name parameter should contain only the host name.

Parameters

Input
name Points to a host name, and optionally, a port and an address family, in the form: family:host[port]. The family: and [port] parameters are optional. If you specify a family variable as part of the name parameter, you must specify socket_$unspec in the family parameter. The only supported value for the family variable is ip. The host parameter specifies the host name, and port specifies a port number in integer form.
nlength Specifies the number of characters in the name parameter.
port Specifies the socket port number. If you are not specifying a well-known port, this parameter should have the value socket_$unspec_port. The returned socket address will specify the Local Location Broker (LLB) forwarding port at the host. If you specify the port number in the name parameter, this parameter is ignored.
family Specifies the address family to use for the socket address. This value corresponds to the communications protocol used to access the socket and determines how the socket address (sockaddr) parameter is expressed. If you specify the address family in the name parameter, this parameter must have the value socket_$unspec.
Output
sockaddr Points to the socket address corresponding to the name, port, and family parameters.
slength Points to the length, in bytes, of the socket address (specified by the sockaddr parameter).
status Points to the completion status.

Examples

To place in the sockaddr structure a socket address that specifies the LLB forwarding port at the host identified by host_name, enter:

rpc_$name_to_sockaddr(host_name, strlen(host_name),
  socket_$unspec_port,socket_$dds, &sockaddr, &slen, &st);

Implementation Specifics

This Library Routine is part of Network Computing System in Network Support Facilities in Base Operating System (BOS) Runtime.

Related Information

Remote Procedure Call (RPC) Runtime Library (NCS) in AIX Version 4.3 Communications Programming Concepts.


[ Previous | Next | Contents | Glossary | Home | Search ]