Programmering III December

From Teknologisk videncenter
Revision as of 08:48, 13 December 2016 by Makn (talk | contribs) (Created page with "===UDP listener:=== '''Server:''' <source lang="Csharp"> UdpClient client = new UdpClient(11000); IPEndPoint endpoint = new IPEndPoint(IPAddress.Any, 11000); ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

UDP listener:

Server:

UdpClient client = new UdpClient(11000);
            IPEndPoint endpoint = new IPEndPoint(IPAddress.Any, 11000);

            byte[] recivedBytes = client.Receive(ref endpoint);
            Console.WriteLine("The message was:");
            string result = Encoding.ASCII.GetString(recivedBytes);
            Console.WriteLine(result);

            Console.ReadKey();