Internet Direct (Indy)
Home
PreviousUpNext
TIdStack.Bind Method

Associates a local address with a socket handle.

Pascal
procedure Bind(
    ASocket: TIdStackSocketHandle; 
    const AIP: string; 
    const APort: Integer; 
    const AIPVersion: TIdIPVersion = ID_DEFAULT_IP_VERSION
); virtual; abstract;
Parameters 
Description 
ASocket 
Socket handle to bind.
 
AIP 
IP address to use for the local netwoek connection.
 
APort 
Port number to use for thelocal network connection.
 
AIPVersion 
IP address family for the IP address. 

Bind is an abstract virtual procedure that specifies the method used to access the Bind() API for a protocol stack implementation. Bind is used on a disconnected socket prior to calling Connect or Listen

When a socket handle is created, it generally doesn't have enough information to assign the Address family, IP address, and port number for the local network connection. Bind sets the local association for the socket handle by assigning the address family, IP address, and port number for the socket handle. 

If an application does not care what local address is assigned, the value INADDR_ANY is used. The protocol stack will assign an appropriate local network address. VIP is used to return the IP address assigned by the protocol stack. 

When the port number 0 (zero), the protocol stack will assign a unique port to the application with a value between 1024 and 5000. VPort is used to return the value assigned by the protocol stack. 

Bind is used on both stream and datagram socket handles.

Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.