Occurs when data can be written to the client.
The event handler receives an argument of type InternetServer.WriteEventArgs containing data related to this event. The following InternetServer.WriteEventArgs property provides information specific to this event.
| Property | Description |
|---|---|
| Handle | Gets a value that specifies the socket handle for the client session. |
The OnWrite event is generated when the client can accept data from the server. The Handle event argument property specifies the handle to the client socket and can be used in conjunction with the Write or WriteLine methods.
This event is typically fired once when the client connection is established with the server, the session thread starts and the client socket enters a writable state. If the internal send buffer for the client socket becomes full, this event will fire again when more data can be written to the socket. It is important to note that this event is level-triggered and will not fire repeatedly if the client socket is writable. Under most circumstances this event fire only once for each client session after the initial connection has been established.
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.
InternetServer Class | SocketTools Namespace