rresvport_af - Retrieve a socket with a privileged address
int family );
Standard C Library (libc)
Specifies the port to use for the connection. Specifies
the address family for the socket to be created. Valid
values are AF_INET (IPv4) and AF_INET6 (IPv6).
The rresvport_af() function obtains a socket with a privileged
address bound to the socket. A privileged Internet
port is one that falls in the range of 0 to 1023.
Only processes with an effective user ID of root can use
the rresvport_af() function. 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 for the specified address family
is returned to the calling process.
Upon successful completion, the rresvport_af() function
returns a valid, bound socket descriptor. Otherwise, a
value of -1 is returned and errno is set to indicate the
If the rresvport_af() function fails, errno may be set to
one of the following values: All network ports are in use.
The addresses in the specified address family cannot be
used with this socket. Two hundred (200) file descriptors
are currently open. The system file table is full.
Insufficient buffers are available in the system to complete
Contains the service names.
Functions: rcmd(3), ruserok(3)
[ Back ]