PowerTCP Emulation for .NET
Log Event (TcpBase)
Example 




Raised when data is read or written.
Syntax
Event Data

The event handler receives an argument of type DataEventArgs containing data related to this event. The following DataEventArgs properties provide information specific to this event.

PropertyDescription
Data Gets data provided by Data and Log events.  
Message Returns the message argument provided by the Marshal method. (Inherited from Dart.Emulation.UserStateEventArgs)
UserState Returns the user state argument provided by the Marshal method. (Inherited from Dart.Emulation.UserStateEventArgs)
Remarks
The handler must be added before connecting. See the SynchronizingObject property for information on updating UI controls in your event handler.
Example
This example demonstrates logging sent and received data to a textbox.
private void myComponent_Log(object sender, DataEventArgs e)
{
    string prompt = (e.Data.Direction == DataDirection.In) ? "Recv: " : "Sent: ";
    textBox1.AppendText(prompt + e.Data.ToString() + Environment.NewLine);
}
Private Sub myComponent_Log(ByVal sender As Object, ByVal e As DataEventArgs)
    Dim prompt As String = If(e.Data.Direction = DataDirection.In, "Recv: ", "Sent: ")
    textBox1.AppendText(prompt & e.Data.ToString() & Environment.NewLine)
End Sub
See Also

Reference

TcpBase Class
TcpBase Members


PowerTCP Emulation for .NET Documentation Version 4.7
© 2018 Dart Communications. All Rights Reserved.
Send comments on this topic