Internet Direct (Indy)
Home
PreviousUpNext
IdPorts Function

List of defined ports in the services file for the local host.

Pascal
function IdPorts: TList;

TList - List contain object references for defined port numbers.

IdPorts is a TList function that returns the list of defined port numbers in the services file for the local host. IdPorts is a convenience function that provides access to the global GIdPorts variable for the Indy library. If the global GIdPorts variable has not been initialized, valid uncommented port numbers are read from the services file and added to the list. 

ServicesFilePath is used to determine the location of the services file for the local host based on the current platform or operating system. 

Duplicate port numbers, resulting from use with multiple protocols, are ignored. 

The TList instance contains object references created in the following manner: 

 

  GIdPorts.Add(TObject(i));

 

IdPorts is freed during finalization for the Indy library (or when the application is closing).

Do not free the TList instance returned by IdPorts. This list is freed by the finalization code in the IdGlobal.pas unit. 

IdPorts and GIdPorts are not defined for the .Net platform.

Exceptions 
Description 
Exception raised when an invalid line is read from the services file. Invalid lines include any uncommented entry without a valid port number prior to the '/' character. Uses the resource string RSCorruptServicesFile for formatting. 
  if IdPorts.IndexOf(TObject(IdPORT_ECHO)) = -1 then
    DebugOutput('ECHO port not defined.');
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.