Dart.PowerTCP.SslSockets Namespace > Udp Class : Active Property (Udp) |
Returns true when listening for datagrams.
[Visual Basic]
<BrowsableAttribute(False)>
<DescriptionAttribute("Returns true if the socket is in use.")>
Public ReadOnly Property Active As Boolean
[C#]
[BrowsableAttribute(false)]
[DescriptionAttribute("Returns true if the socket is in use.")]
public bool Active {get;}
[C++]
[BrowsableAttribute(false)]
[DescriptionAttribute("Returns true if the socket is in use.")]
public: __property bool get_Active();
[C++/CLI]
[BrowsableAttribute(false)]
[DescriptionAttribute("Returns true if the socket is in use.")]
public:
property bool Active {
bool get();
}
true if the Udp component is actively listening for datagrams; false otherwise.
After successfully calling Open, this property returns true. After calling Close or Dispose, this property will return false.
When the value of this property changes, the ActiveChanged event is raised.
The following example demonstrates the Udp.ActiveChanged event
[Visual Basic]
Private Sub ActiveChangedTest()
' Create an IPEndPoint
Dim ep As System.Net.IPEndPoint = New System.Net.IPEndPoint(System.Net.IPAddress.Parse("192.168.0.71"), 1111)
' Begin listening on the specified endpoint. The ActiveChanged event should be raised.
Udp1.Open(ep)
' Stop listening. The ActiveChanged event should be raised again.
Udp1.Close()
End Sub
Private Sub Udp1_ActiveChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Udp1.ActiveChanged
If Udp1.Active Then
Debug.WriteLine("Listening on " + Udp1.LocalEndPoint.ToString())
Else
Debug.WriteLine("Not Listening")
End If
End Sub
[C#]
private void ActiveChangedTest()
{
// Create an IPEndPoint
System.Net.IPEndPoint ep = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("192.168.0.71"), 1111);
// Begin listening on the specified endpoint. The ActiveChanged event should be raised.
udp1.Open(ep);
// Stop listening. The ActiveChanged event should be raised again.
udp1.Close();
}
private void udp1_ActiveChanged(object
sender, System.EventArgs e)
{
if(udp1.Active)
Debug.WriteLine("Listening on " + udp1.LocalEndPoint.ToString());
else
{
Debug.WriteLine("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.