[Previous] [Contents] [Index] [Next]

bindresvport()

Bind a socket to a privileged IP port

Synopsis:

#include <sys/types.h>
#include <netinet/in.h>

int bindresvport( int sd,
                  struct sockaddr_in * sin );

Library:

socket3r.lib, socket3s.lib

Description:

The bindresvport() function binds a socket descriptor to a privileged IP port (i.e. a port number in the range 0-1023).


Note: Only root can bind to a privileged port; this call fails for any other user.

Returns:

0
Success.
-1
An error occurred (errno is set).

Errors:

EACCES
You must be root to call bindresvport().
EADDRINUSE
The specified address is already in use.
EADDRNOTAVAIL
The specified address isn't available from the local machine.
EBADF
Invalid descriptor sd.
EFAULT
The sin parameter isn't a valid pointer to a sockaddr_in structure.
EINVAL
The socket is already bound to a port.
EPFNOSUPPORT
The protocol family isn't supported.

Classification:

Unix

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

connect(), getsockname(), listen(), socket()


[Previous] [Contents] [Index] [Next]