Advertisement
NAK

UDP Client

NAK
Apr 22nd, 2013
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net;
  5. using System.Net.Sockets;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9. namespace Client
  10. {
  11.     class Program
  12.     {
  13.         private static byte[] data;
  14.         static void Main(string[] args)
  15.         {
  16.  
  17.             IPEndPoint RemoteEndPoint= new IPEndPoint(
  18.             IPAddress.Parse("127.0.0.1"), 9050);
  19.             Socket server = new Socket(AddressFamily.InterNetwork,
  20.                                        SocketType.Dgram, ProtocolType.Udp);
  21.             string welcome = "Hello World";
  22.             data = Encoding.ASCII.GetBytes(welcome);
  23.             server.SendTo(data, data.Length, SocketFlags.None, RemoteEndPoint);
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement