I tery to write a very simple UDP listening server.
the code goes like this:
UdpClient udp = new UdpClient();
IPEndPoint rip = new IPEndPoint(IPAddress.Any, 0);
byte[] msg = udp.Receive(ref rip);
when I run it I have the following exception:
Unhandled Exception: System.Net.Sockets.SocketException: An invalid argument
was supplied
at System.Net.Sockets.Socket.ReceiveFrom(Byte[] buffer, Int32 offset,
Int32 size, SocketFlags socketFlags, EndPoint& remoteEP)
at System.Net.Sockets.UdpClient.Receive(IPEndPoint& remoteEP)
what that could be ?
Feroze [MSFT] - 18 Dec 2003 00:13 GMT
You need to bind the local endpoint first. You can do it by creating
UdpClient with a port ( new UdpClient(int port))

Signature
Remove "user" from the email address to reply to the author.
This posting is provided "AS IS" with no warranties, and confers no rights
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
> I tery to write a very simple UDP listening server.
> the code goes like this:
[quoted text clipped - 11 lines]
>
> what that could be ?
Lloyd Dupont - 18 Dec 2003 10:20 GMT
thanks !
I had found it ;-)
> You need to bind the local endpoint first. You can do it by creating
> UdpClient with a port ( new UdpClient(int port))
[quoted text clipped - 15 lines]
> >
> > what that could be ?