Socket.sentTo : Socket « System.Net.Sockets « C# / C Sharp by API






Socket.sentTo

  

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

class MultiSend
{
   public static void Main()
   {
      Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
      IPEndPoint iep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 9050);
      
      byte[] data = Encoding.ASCII.GetBytes("This is a test message");
      server.SendTo(data, iep);
      server.Close();
   }
}

   
    
  








Related examples in the same category

1.new Socket( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp )
2.Socket.AddressFamily
3.Socket.Bind(IPEndPoint ip)
4.Socket.Blocking
5.Socket.Connect(IPEndPoint ip)
6.Socket.Connected
7.Socket.Listen
8.Socket.LocalEndPoint
9.Socket.ProtocolType
10.Socket.Receive(byte[] data)
11.Socket.ReceiveFrom
12.Socket.Send(String stringValue)
13.Socket.Send(data, data.Length, SocketFlags.None)
14.Socket.SocketType