Occurs when a connection is established with the remote host.
The event handler receives an argument of type InternetServer.ConnectEventArgs containing data related to this event. The following InternetServer.ConnectEventArgs property provides information specific to this event.
| Property | Description |
|---|---|
| Handle | Gets a value that specifies the socket handle for the client session. |
The OnConnect event occurs when the client connection to the server has completed.
The ClientAddress property can be used to determine the IP address of the client which established the connection. To terminate the client connection, use the Disconnect method.
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.