Dart.PowerTCP.SslSockets Namespace : Udp Class |
The Udp component provides comprehensive User Datagram Protocol support.
For a list of all members of this type, see Udp members.
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
Dart.PowerTCP.SslSockets.Udp
[Visual Basic]
<DescriptionAttribute("The Udp Component integrates event handling and a concise UDP model")>
<LicenseProviderAttribute(UdpLicenseProvider)>
Public Class Udp
Inherits Component
[C#]
[DescriptionAttribute("The Udp Component integrates event handling and a concise UDP model")]
[LicenseProviderAttribute(UdpLicenseProvider)]
public class Udp : Component
[C++]
[DescriptionAttribute("The Udp Component integrates event handling and a concise UDP model")]
[LicenseProviderAttribute(UdpLicenseProvider)]
public __gc class Udp : public Component
[C++/CLI]
[DescriptionAttribute("The Udp Component integrates event handling and a concise UDP model")]
[LicenseProviderAttribute(UdpLicenseProvider)]
public ref class Udp : public Component
Use the Udp Component to send and receive UDP datagrams. It simplifies the use of UDP communications by providing methods to send/receive datagrams, listen for datagrams, and multicast/broadcast. Synchronous and asynchronous use is fully supported.
What follows are short usage descriptions. For more information, see the appropriate member topic.
Listen for datagrams: The Open method causes the Udp component to allocate a socket for sending and receiving datagrams.
Send/receive datagrams: Use the Send and Receive methods to send/receive datagrams.
Join/leave multicast groups: Use the JoinMulticastGroup to join a multicast group. Use the LeaveMulticastGroup to leave a multicast group.
Asynchronous use: Use the BeginSend and BeginReceive methods to send/receive datagrams asynchronously.
The following example demonstrates sending some datagrams to an echo server and receiving the datagrams from the echo server.
[Visual Basic]
Dim iterations as Integer = 3
' Listen on the default interface and an ephemeral port.
udp1.Open()
' Send several datagrams
Dim s as String = "test"
Dim i as Integer
For i=0 to iterations
Udp1.send(s, "MyEchoServer", 7)
Next
' receive the echoed datagrams, there should be 3...requiring 3 Udp.Receive calls.
For i=0 to iterations
Dim d as Datagram = Udp1.Receive(s.Length)
Debug.WriteLine(d.ToString())
Next
'* Output
'* ------------------------
'* test
'* test
'* test
'* ------------------------
'*
[C#]
int iterations = 3;
// Listen on the default interface and an ephemeral port.
udp1.Open();
// Send several datagrams
string s = "test";
for(int i=0; i<iterations; i++)
udp1.send(s, "MyEchoServer", 7);
// receive the echoed datagrams, there should be 3...requiring 3 Udp.Receive calls.
for(int i=0; i<iterations; i++)
{
Datagram d = udp1.Receive(s.Length);
Debug.WriteLine(d.ToString());
}
/* Output
* ------------------------
* test
* test
* test
* ------------------------
*/
Namespace: Dart.PowerTCP.SslSockets
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: Dart.PowerTCP.SslSockets (in Dart.PowerTCP.SslSockets.dll)
Udp Members | Dart.PowerTCP.SslSockets Namespace
Send comments on this topic.
Documentation version 1.1.2.0.
© 2008 Dart Communications. All rights reserved.