login about faq

I looked through the forums and couldn't seem to find this information. Is there an event that I can trigger when the remote host disconnects an SSH connection? Say for example, to close a terminal if the remote side ends the connection?

asked Oct 29 '13 at 17:18

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

edited Oct 29 '13 at 17:18


I get this kind of question from time to time. The answer is that you only need to remember the most fundamental thing about computer programs -- that they are series of instructions executed one after the other.

What is an "event callback"? It's where your application essentially provides a function pointer that will be called back from within the called method. Let's follow the thread of execution:

  1. Your application is executing code one statement after the other.
  2. It makes a call into a Chilkat method.
  3. Now the code internal to the Chilkat method is executing one statement after the other.
  4. A call is made to a function in your application via the callback function pointer. Now your application is executing code one statement after another.
  5. The callback function returns, reverting control back to the Chilkat internal code, which is now executing one statement after the other.
  6. The Chilkat method returns, reverting control back to your application, which continues executing one statement after the other.

To answer your question: Chilkat would only know about the disconnect if it was actively trying to read/write the socket. That can only happen when your application has made a Chilkat method call and the thread of execution is within the Chilkat method. Upon a disconnect, it wouldn't be an event that is raised, but it would simply cause the Chilkat method call to return.

link

answered Oct 29 '13 at 17:28

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

edited Oct 29 '13 at 19:38

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×10
×1

Asked: Oct 29 '13 at 17:18

Seen: 819 times

Last updated: Oct 29 '13 at 19:38

powered by OSQA