Thanks rlebeau.
I followed what you said and it seems to work now
What I did was call IdTelnet.Disconnect from IdTelnet.TelnetThread.OnException.
This calls IdTelnet.OnDisconnected event in the case of abnormal socket disconnect,
so the application can respond to all kinds of disconnections (graceful or otherwise)
I also added a form variable fIsTelnetConnected that is updated on IdTelnet events
OnConnected and OnDisconneted, since IdTelnet.IOHandler.Connected can
return a false positive, as in the case of abnormal disconnect.
I followed what you said and it seems to work now
What I did was call IdTelnet.Disconnect from IdTelnet.TelnetThread.OnException.
This calls IdTelnet.OnDisconnected event in the case of abnormal socket disconnect,
so the application can respond to all kinds of disconnections (graceful or otherwise)
I also added a form variable fIsTelnetConnected that is updated on IdTelnet events
OnConnected and OnDisconneted, since IdTelnet.IOHandler.Connected can
return a false positive, as in the case of abnormal disconnect.