PowerTCP Sockets for .NETfrom $349.00
Windows Forms UDP Multicast Code Example
The following C# example demonstrates a UDP session in a Windows Forms environment. The app joins a multicast group, sends a message, receives a response and leaves. The session is executed asynchronously, without blocking the UI.
private void buttonHello_Click(object sender, EventArgs e)
//This application has a User-Interface, which we do not want to block.
//Start launches the specified method on a worker thread.
udp1.Start(sendHello, new Dart.Sockets.IPEndPoint("188.8.131.52", 59877));
private void sendHello(object groupEP)
//Join a multicast group, send a message, receive a response, and leave.
//The group endpoint is passed into the function.
Dart.Sockets.IPEndPoint ep = (Dart.Sockets.IPEndPoint)groupEP;
//Join Multicast group.
udp1.Send("hello world", ep);
byte buffer = new byte;
To download a trial please visit the PowerTCP Sockets for .NET product page.