Hi,
How do you get the clients IP and port in the Onclienterror event in the sshserver component?
Get client IP in OnClientError of SSHserver component
-
- Posts: 132
- Joined: Wed 17 Aug 2016 05:57
Re: Get client IP in OnClientError of SSHserver component
To solve the issue try to use the following code:
Code: Select all
procedure TSSHServerFrame.ScSSHServerClientError(Sender: TObject;
ClientInfo: TScSSHClientInfo; E: Exception);
var
IP, Port: string;
Sock: TIPEndPoint;
begin
Sock := TIPEndPoint.Create(PSockAddrIn(ClientInfo.SockAddr));
try
IP := Sock.ToString;
Port := IntToStr(Sock.Port)
finally
Sock.Free;
end;
end;