Bad Broadcast

image_pdfimage_print
   


using System;
using System.Net;
using System.Net.Sockets;
using System.Text;

public class BadBroadcast {
   public static void Main()
   {
      Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
      IPEndPoint iep = new IPEndPoint(IPAddress.Broadcast, 9050);

      byte[] data = Encoding.ASCII.GetBytes("This is a test message");
      sock.SendTo(data, iep);
      sock.Close();
   }
}

           
          


This entry was posted in C# Network. Bookmark the permalink.