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

rpc_$sockaddr_to_name Library Routine

Purpose

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

Syntax

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

Description

The rpc_$sockaddr_to_name routine provides the address family, the host name, and the port number identified by the specified socket address.

Parameters

Input
sockaddr Points to a socket address.
slength Specifies the length, in bytes, of socket address (sockaddr) parameter.
Input/Output
nlength On input, points to the length of the name parameter in the buffer. On output, points to the number of characters returned in the name parameter.
Output
name Points to a character string that contains the host name and the address family in the format: family:host. The value of the family parameter must be ip.
port Points to the socket port number.
status Points to the completion status.

Examples

To take the bank server's socket address, return the server's host name and port, and then print the information, enter:

rpc_$sockaddr_to_name(&saddr, slen, name, &namelen, &port, &st);
  printf("(bankd) name=\"%.*s\", port=%d\n", name, namelen, port;

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 ]