Dart.PowerTCP.SslSockets Namespace > Server Class : ActiveChanged Event (Server) |
Raised when the value of the Object.Active property changes.
[Visual Basic]
<DescriptionAttribute("Raised when the value of the Active property changes.")>
Public Event ActiveChanged() As EventHandler
[C#]
[DescriptionAttribute("Raised when the value of the Active property changes.")]
public event EventHandler ActiveChanged();
[C++]
[DescriptionAttribute("Raised when the value of the Active property changes.")]
public: __event EventHandler* ActiveChanged();
[C++/CLI]
[DescriptionAttribute("Raised when the value of the Active property changes.")]
public:
event EventHandler^ ActiveChanged();
This event is raised when the value of the Object.Active property changes, which occurs when the object (usually either the Server component or Udp component) either begins listening or stops listening for connections. Inside the event, check the Object.Active property see determine if the event which is the case.
This event is useful because it allows action to be taken (for example, disabling or enabling GUI elements) based on whether the object is actively listening or closed.
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.