UdpClient: Send : UdpClient « Network « C# / CSharp Tutorial






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

class MainClass
{
   public static void Main()
   {
      UdpClient sock = new UdpClient();
      IPEndPoint iep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 9999);
      byte[] data = Encoding.ASCII.GetBytes("This is a test message");
      sock.Send(data, data.Length, iep);
      sock.Close();
   }
}








33.13.UdpClient
33.13.1.Use UdpClient
33.13.2.Binary UdpClient: send binary data to Udp server
33.13.3.Binary Udp Server: receive binary data from Udp client
33.13.4.UdpClient: Send
33.13.5.UdpClient: receive for multicast group
33.13.6.Udp connection test