UdpClient.EnableBroadcast : UdpClient « System.Net.Sockets « C# / C Sharp by API






UdpClient.EnableBroadcast

  
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.IO.Compression;
using System.Net;
using System.Net.Mail;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Xml;

public class MainClass
{
    public static void Main()
    {
        using (UdpClient udp = new UdpClient(1024))
        {
            IPAddress groupAddress = IPAddress.Parse("0.0.0.0");
            udp.JoinMulticastGroup(groupAddress, 32);
            udp.EnableBroadcast = true;

            IPEndPoint sentBy = null;
            byte[] data = udp.Receive(ref sentBy);
            udp.DropMulticastGroup(groupAddress);
        }
    }
}

   
    
  








Related examples in the same category

1.UdpClient.DropMulticastGroup
2.UdpClient.JoinMulticastGroup
3.UdpClient.Receive
4.UdpClient.Send