IHow do I get the Peer's IP Address in the TIdTCPServer?

Previous  Top  Next

For Indy 8.0

 

Use code such as this:

 

procedure TfrmMain.TCPServerConnect(AThread: TIdPeerThread);

var PeerIP : String;

begin

   PeerIP := Thread.Connection.Binding.PeerIP;

end;

 

For Indy 9.0

 

Use code such as this:

 

uses IdIOHandlerSocket;

 

procedure TfrmMain.TCPServerConnect(AThread: TIdPeerThread);

var PeerIP : String;

begin

   PeerIP := TIdIOHandlerSocket(AThread.Connection.IOHandler).Binding.PeerIP;

end;

 

For Indy 10.0

 

Use code such as this:

 

uses IdContext, IdIOHandlerSocket;

 

procedure TfrmMain.TCPServerConnect(AContext: TIdContext);

var PeerIP : String;

begin

   PeerIP := AContext.Connection.Socket.Binding.PeerIP;

end;