Bad Broadcast : Broadcast « Network « C# / C Sharp






Bad Broadcast


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();
   }
}

           
       








Related examples in the same category

1.Receive Broadcast
2.Broadcst Sample