[Overview][Constants][Types][Procedures and functions][Variables] Reference for unit 'Sockets' (#rtl)

Bind

Bind a socket to an address.

Declaration

Source position: line 0

function Bind(

  Sock: LongInt;

  const Addr;

  AddrLen: LongInt

):Boolean;

function Bind(

  Sock: LongInt;

  const addr: String

):Boolean;

Description

Bindbinds the socket Sockto address Addr. Addrhas length Addrlen. The function returns Trueif the call was succesful, Falseif not.

The form of the Bindcommand with the TUnixSockAddris equivalent to subsequently calling Str2UnixSockAddrand the regular Bindfunction. The function returns Trueif successfull, Falseotherwise.

Errors

Errors are returned in SocketErrorand include the following:

SYS_EBADF
The socket descriptor is invalid.
SYS_EINVAL
The socket is already bound to an address,
SYS_EACCESS
Address is protected and you don't have permission to open it.

More arrors can be found in the Unix man pages.

See also

Socket

  

Create new socket