[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: which LibSSH API notifies Client if Server gets Disconnected.


Please help me with below query. Which api to use in client side to figure out if Server is disconnected or not working.
Please guide me.

Regards ,
Nagraju


From: [ext] V Sidnal, Nagraju <nagraju.sidnal@xxxxxxxxxxx>
Sent: Tuesday, June 30, 2020 10:35 PM
To: libssh@xxxxxxxxxx
Subject: RE: which LibSSH API notifies Client if Server gets Disconnected.

Hi All,

Please help me with my query. Do we have API which can be used in LibSSH Client  to get notification, whenever connection is disconnected from server side or session gets time out at server side.

Regards,
Nagraju

From: V Sidnal, Nagraju (IOT DS AA MO OPS FR-COC)
Sent: Monday, February 17, 2020 7:13 PM
To: libssh@xxxxxxxxxx<mailto:libssh@xxxxxxxxxx>
Subject: which LibSSH API notifies Client if Server gets Disconnected.

Dear Team,

We are using below logic to execute command on SSH Server.

  int rc = ssh_connect(my_ssh_session);
  rc = ssh_pki_import_privkey_file("id_rsa", NULL, NULL, NULL, &pkey);
  rc = ssh_userauth_publickey(my_ssh_session, NULL, pkey);
  channel = ssh_channel_new(my_ssh_session);
  rc = ssh_channel_open_session(channel);
  rc = ssh_channel_request_exec(channel, "lscommand");
//after this we reading the result & closing the channel.

We are keeping session saved in our class for next command execution/call iteration, so that we don't need to create connection again.
However For next call, every time we are creating new channel for executing the command, as we cannot use same channel.

We are running some logic internally, which keeps checking  ssh_is_connected() , to keep track of connection status with Server.
However this logic looks heavy.

Could you please help me with the API of libssh - callback API's of libssh, using which I don't need to check ssh_is_connected().
I'm unable to figure out a Call back Api , using which Client will get notified whenever server gets disconnected.

Thanks in advance.

Regards,
Nagraju


Archive administrator: postmaster@lists.cynapses.org