Internet Direct (Indy) Version 9.0.2 Beta
TIdSocketHandle.Bind
Associates a local address with a socket.

procedure Bind;
Description
Bind is used on an unconnected socket to associate the IP and Port of the local host with Handle prior to Connect or Listen operations.

If the application does not care what address is assigned to it, it may use a blank IP (''). This allows the protocol stack to assign the Internet address Id_INADDR_ANY, and an any appropriate network interface will be used.

If the application does not care what port is assigned to it, it may use Port 0. This allows the protocol stack to assign a unique port to the application with a value between 1024 and 5000.

Use SetSockOpt to alter socket-level settings including broadcast, linger, buffering, and Nagle options.

Bind will raise an EIdException if the address in IP and Port is already in use.