[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Communications Technical Reference, Volume 2

rresvport Subroutine

Purpose

Retrieves a socket with a privileged address.

Library

Standard C Library (libc.a)

Syntax

int rresvport (Port)
int *Port;

Description

The rresvport subroutine obtains a socket with a privileged address bound to the socket. A privileged Internet port is one that falls in a range between 0 and 1023.

Only processes with an effective user ID of root user can use the rresvport subroutine. An authentication scheme based on remote port numbers is used to verify permissions.

If the connection succeeds, a socket in the Internet domain of type SOCK_STREAM is returned to the calling process.

Parameters

Port Specifies the port to use for the connection.

Return Values

Upon successful completion, the rresvport subroutine returns a valid, bound socket descriptor.

If the rresvport subroutine is unsuccessful, the subroutine handler performs the following functions:

Error Codes

The rresvport subroutine is unsuccessful if any of the following errors occurs:

EAGAIN All network ports are in use.
EAFNOSUPPORT The addresses in the specified address family cannot be used with this socket.
EMFILE Two hundred file descriptors are currently open.
ENFILE The system file table is full.
ENOBUFS Insufficient buffers are available in the system to complete the subroutine.

Implementation Specifics

The rresvport subroutine is part of Base Operating System (BOS) Runtime.

All applications containing the rresvport subroutine must be compiled with _BSD set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.

Files

/etc/services Contains the service names.

Related Information

The rcmd subroutine, ruserok subroutine.

Sockets Overview in AIX Version 4.3 Communications Programming Concepts.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]