Dart.PowerTCP.SslSockets Namespace > Server Class : Active Property (Server) |
Returns true when listening for connections.
[Visual Basic]
<BrowsableAttribute(False)>
<DefaultValueAttribute()>
<CategoryAttribute("Connection Info")>
<DescriptionAttribute("Returns <true> when listening for connections.")>
Public ReadOnly Property Active As Boolean
[C#]
[BrowsableAttribute(false)]
[DefaultValueAttribute()]
[CategoryAttribute("Connection Info")]
[DescriptionAttribute("Returns <true> when listening for connections.")]
public bool Active {get;}
[C++]
[BrowsableAttribute(false)]
[DefaultValueAttribute()]
[CategoryAttribute("Connection Info")]
[DescriptionAttribute("Returns <true> when listening for connections.")]
public: __property bool get_Active();
[C++/CLI]
[BrowsableAttribute(false)]
[DefaultValueAttribute()]
[CategoryAttribute("Connection Info")]
[DescriptionAttribute("Returns <true> when listening for connections.")]
public:
property bool Active {
bool get();
}
true if the Server component is actively listening for connections; false otherwise.
After successfully calling Listen, this property returns true. After calling Close or Abort, this property will return false.
When the value if this property changes, the ActiveChanged event is raised.
The following example demonstrates the Server.ActiveChanged event.
[Visual Basic]
Private Sub StartServer()
' Begin listening for connections on port 7.
Server1.Listen(7)
End Sub
Private Sub Server1_ActiveChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Server1.ActiveChanged
' Check the Active property.
If Server1.Active Then
Label1.Text = "Server is listening at " + Server1.LocalEndPoint.ToString()
Else
Label1.Text = "Server is not listening."
End If
End Sub
[C#]
private void StartServer()
{
// Begin listening for connections on port 7.
server1.Listen(7);
}
private void server1_ActiveChanged(object
sender, System.EventArgs e)
{
// Check the Active property.
if(server1.Active)
label1.Text = "Server is listening at " +
server1.LocalEndPoint.ToString();
else
label1.Text = "Server is not listening.";
}
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Send comments on this topic.
Documentation version 1.1.2.0.
© 2008 Dart Communications. All rights reserved.