Recent

Author Topic: (Looks never solved) How to check SSH is still connected (Alive) in Synapse?  (Read 855 times)

Dio Affriza

  • Jr. Member
  • **
  • Posts: 95
I have been using this topic [SOLVED] Stuck using Synapse tlntsend as SSH client but I have a problem when my internet was disconnected and I want to reconnect it again.

I am using this code for now:
Code: Pascal  [Select][+][-]
  1. function TTelnetSSHClient.IsAlive: Boolean;
  2. var
  3.   tlsfk: TTelnetSend;
  4. begin
  5.   tlsfk := TTelnetSend.Create;
  6.   tlsfk.TargetPort := TargetPort;
  7.   tlsfk.UserName := UserName;
  8.   tlsfk.Password := Password;
  9.   tlsfk.TargetHost := TargetHost;
  10.   tlsfk.Timeout := 500;
  11.   if tlsfk.Login then
  12.     Result := True
  13.   else
  14.     Result := False;
  15.   tlsfk.Free;
  16. // these thing bellow also used, and nothing happening
  17.   //Result := (Sock.Socket = INVALID_SOCKET) or ((Sock.WaitingData = 0) and Sock.CanRead(0));
  18. end;  
  19.  

Does anyone know the better way to check the connection is still alive?  :)
« Last Edit: July 18, 2021, 05:55:40 pm by Dio Affriza »

 

TinyPortal © 2005-2018