Simple UDP socket...??

Jan 27 2005 2:09 PM
Just a quick question on sockets using UDP, not TCP... The code below is what I'm trying...I just want this simple console application to wait for some bytes...but it says that an "invalid argument" was supplied. I have all the right parameters in there, so I have no idea why it isn't accepting it...any help? Socket testSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); // UPD Socket IPEndPoint src = new IPEndPoint(IPAddress.Any, 0); // For source endpoint byte[] test = new Byte[1024]; // To store the received "message" EndPoint tempEP = (EndPoint)src; // Placeholder for the remote EP try { testSocket.ReceiveFrom(test, ref tempEP); // ...it just exceptions... } catch(Exception e){Console.WriteLine(e.ToString());}