//Server using System.Net; using System.Net.Sockets; string xName = "string to send"; byte[] packetData = System.Text.ASCIIEncoding.ASCII.GetBytes(xName); string IP = "127.0.0.1"; int port = 80; IPEndPoint ep = new IPEndPoint(IPAddress.Parse(IP), port); Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); client.SendTo(packetData, ep); //Client using System.Net; using System.Net.Sockets; using System.Collections.Specialized; using System.Linq; private static Exception socketException = null; static void OpenSocket() { byte[] data = new Byte[256]; IPEndPoint ServerEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 80); Socket WinSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); WinSocket.ReceiveTimeout = 0; WinSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 0); WinSocket.Bind(ServerEndPoint); IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0); EndPoint Remote = (EndPoint)(sender); int recv = WinSocket.ReceiveFrom(data, ref Remote); string DataRecieved = Encoding.ASCII.GetString(data, 0, recv); }