Topic Path: Symbol Reference > Classes > TIdCustomTCPServer Class > TIdCustomTCPServer Properties > Bindings Property
TIdCustomTCPServer.Bindings Property

Container for socket handles allocated by the server.

property Bindings: TIdSocketHandles;

Bindings is a TIdSocketHandles property that represents a collection of TIdSocketHandle instances used in the server. Items in the Bindings collection are used in listener thread(s) (TIdListenerThread instances) to access the socket handle for listening for and accepting new connection requests, as well as establishing the IOHandler for client connections accepted by the server. 

Resources for the Bindings property are allocated during initialization of the component instance, and freed in the Destroy method. 

Bindings is used when reading and writing the value for the DefaultPort property. Reading the value in the DefaultPort property retrieves the property value stored in the Bindings collection. Changing the value in the DefaultPort property causes the property value in Bindings to be updated. 

Change the value in DefaultPort or Bindings.DefaultPort prior to creating TIdSocketHandle instances in the collection or setting Active to True. Changes to the property value are not automatically assigned to existing TIdSocketHandle instances. 

Bindings is used during startup of the server (when Active is set to True). TIdSocketHandle instances are added to Bindings when no existing socket handles are defined. A TIdSocketHandle instance is created for each Internet address family (IPv4, IPv6) supported on the protocol stack for the platform hosting the Indy library. 

Multiple listener threads can be defined in Bindings for multi-homed servers, or servers that listen on multiple ports. TIdSocketHandle instances can be added to Bindings (either in code, or using the IDE) for each network adapter IP address, IP address family, and port combination to use in detecting connection requests. 

During startup, TIdSocketHandle instances in Bindings are allocated socket handles with the socket options specified in the ReuseSocket property. The socket handles are then bound using the the IP address, IP address family, and port number for the TIdSocketHandle instances. 

When all socket handles in Bindings are successfully bound, each TIdSocketHandle instance is instructed to listen for client connection request using the backlog indicated in ListenQueue. A TIdListenerThread instance is created for each of the TIdSocketHandle instances in Bindings. Listener threads are added to the internal list maintained by the server, and execution of each listener thread is started.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.