Telnet Object : Receive Event |
Visual Basic |
---|
Public Event Receive() |
WARNING Timeout must be 0 when calling methods from within an event. Failure to observe this rule may cause reentrancy problems and unpredictable results.
The Receive, Fill, and Search methods are used to receive data. By putting one of these methods in the body of this event, you can optimize the processing speed of your application without blocking (waiting for data to arrive) or polling (continually checking for available data).
You can allow data to build up in the system buffers by not accessing the data. In this case, the system will eventually drop packets and communications will slow. This is called back pressure, and is the application-level mechanism that the receiving side of a connection can use to slow down a data transfer.
The Receive method, Fill method, or Search method must be called to enable this event to fire more than once. Normally, you will do this by placing code within the body of this event.
Private Sub Telnet1_Receive() On Error GoTo OnError ' use intrinsic error handling Dim s As String Telnet1.Receive s ' receive as much data as is available into a String Text1.SelText = s ' append received data to text in the text box Exit Sub OnError: ' Any error jumps here Debug.Print "Error #" + CStr(Err.Number) + ": " + Err.Description End Sub