PowerTCP Emulation for .NET
State Property (TcpBase)
Example 




Gets the status of the connection as of the last socket operation.
Syntax
Public ReadOnly Property State As ConnectionState
Dim instance As TcpBase
Dim value As ConnectionState
 
value = instance.State
public ConnectionState State {get;}
public: __property ConnectionState get_State();
public:
property ConnectionState State {
   ConnectionState get();
}
Example
This example demonstrates using the StateChanged event and State property to update the UI.
private void myComponent_StateChanged(object sender, EventArgs e)
{
    if (myComponent.State == ConnectionState.Closed)
        this.Text = "Not Connected";
    else if (myComponent.State == ConnectionState.Connected)
        this.Text = "Connected to " + myComponent.RemoteEndPoint.ToString();
    else
        this.Text = "Securely connected to " + myComponent.RemoteEndPoint.ToString();
}
Private Sub myComponent_StateChanged(ByVal sender As Object, ByVal e As EventArgs)
    If myComponent.State = ConnectionState.Closed Then
        Me.Text = "Not Connected"
    ElseIf myComponent.State = ConnectionState.Connected Then
        Me.Text = "Connected to " & myComponent.RemoteEndPoint.ToString()
    Else
        Me.Text = "Securely connected to " & myComponent.RemoteEndPoint.ToString()
    End If
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