//Create an instance of UdpClient. UdpClient udpClient = new UdpClient(serverName, SAMPLEUDPPORT); Byte[] inputToBeSent = new Byte[256]; inputToBeSent = System.Text.Encoding.ASCII.GetBytes(whatEver.ToCharArray()); IPHostEntry remoteHostEntry = Dns.GetHostByName(serverName); IPEndPoint remoteIpEndPoint = new IPEndPoint(remoteHostEntry.AddressList[0], SAMPLEUDPPORT); int nBytesSent = udpClient.Send(inputToBeSent, inputToBeSent.Length); Byte[] received = new Byte[512]; received = udpClient.Receive(ref remoteIpEndPoint); String dataReceived = System.Text.Encoding.ASCII.GetString(received); Console.WriteLine(dataReceived); udpClient.Close();