|
Summary
Remote connection has been closed.
Description
The OnClose event occurs usually in response to calling the Disconnect or Abort methods (or setting the Action property to ACTION_DISCONNECT or ACTION_ABORT). In some cases, the remote server
may close a connection (for example because of a long period of inactivity). This will also trigger an OnClose event. In this case, the application must still call the Disconnect method (or set the
Action property to ACTION_DISCONNECT) to free up all the resources allocated for the connection. However, this should not be done during the OnClose event because it might result in an infinite loop.
If this event occurs in response to calling the Disconnect method (or setting the Action property to ACTION_DISCONNECT), it will occur before next line of code is executed.
Normally, an application should simply set a flag in response to this event. Then, this flag can be checked directly after the Disconnect method (or the ACTION_DISCONNECT action) to make sure that
the connection was actually terminated.
Example
Sub VT220Client_OnClose () If Connected Then ' disconnect and destroy VT220 terminal Connected = False
Vt220Client.WriteData = "Connection Closed." Vt220Client.Action = ACTION_DISCONNECT Vt220Client.Action = ACTION_DESTROY End If End Sub
|