SocketTools .NET Edition

InternetServer.OnDisconnect Event

Occurs when the remote host disconnects from the local system.

[Visual Basic]
Public Event OnDisconnect As OnDisconnectEventHandler
[C#]
public event OnDisconnectEventHandler OnDisconnect;

Event Data

The event handler receives an argument of type InternetServer.DisconnectEventArgs containing data related to this event. The following InternetServer.DisconnectEventArgs property provides information specific to this event.

Property Description
Handle Gets a value that specifies the socket handle for the client session.

Remarks

The OnDisconnect event is generated when the connection is terminated by the client and there is no more data available to be read.

It is not necessary to call the Disconnect method inside the OnDisconnect event handler because the client session is already in the process of disconnecting from the server.

User interface controls can only be accessed from the UI thread that created them, and attempting to update a control from another thread can result in the program becoming non-responsive or terminating abnormally. Because this event is generated in the context of the client thread, not the thread that created the class instance, you cannot directly modify a control from within this event handler. Instead, you must create a delegate and use the Invoke method to marshal invocations to the associated UI thread. For more information, refer to the documentation for the control.

See Also

InternetServer Class | SocketTools Namespace