Obtain a socket with a privileged address
#include <unistd.h> int rresvport( int * port ); int rresvport_af( int * port, int af );
- An address in the privileged port space. Privileged Internet ports are those in the range 0 to 1023. Only the superuser may bind this type of address to a socket.
- (rresvport_af() only) The address family; see <sys/socket.h>.
Use the -l socket option to qcc to link against this library.
The rresvport() function returns a descriptor to a socket with an address in the privileged port space. The rresvport_af() function is similar, but you can use it for address families other than AF_INET.
The rresvport() and rresvport_af() functions obtain a socket with a privileged address bound to it. This socket can be used by rcmd() and several other functions.
A valid, bound socket descriptor, or -1 if an error occurs (errno is set).
The error code EAGAIN is overloaded to mean All network ports in use.