G
Guest
Hi,
I am changing a program so that it uses a datagram socket object instead of
a UdpClient object. (Is it a good idea to do that ? I heard the socket object
is more robust)
I have a strange problem with the datagram socket. When I invoke the method
"socket.receiveFrom()" I get an exception with the message "An invalid
argument was supplied". I can't see what the problem is.
I though that the remoteEndPoint object is not initialized to the proper
value, or in the proper way, but I am not sure anymore about the source of
the problem.
Here is the code:
//Create a datagram/udp socket.
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram,
ProtocolType.Udp);
EndPoint remoteEndPoint = new IPEndPoint(IPAddress.Any, 0);
socket.ReceiveFrom(VSDpacket, ref remoteEndPoint); //throw an exception with
message "an invalid argument was supplied".
Thanks a lot!
Lionel
I am changing a program so that it uses a datagram socket object instead of
a UdpClient object. (Is it a good idea to do that ? I heard the socket object
is more robust)
I have a strange problem with the datagram socket. When I invoke the method
"socket.receiveFrom()" I get an exception with the message "An invalid
argument was supplied". I can't see what the problem is.
I though that the remoteEndPoint object is not initialized to the proper
value, or in the proper way, but I am not sure anymore about the source of
the problem.
Here is the code:
//Create a datagram/udp socket.
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram,
ProtocolType.Udp);
EndPoint remoteEndPoint = new IPEndPoint(IPAddress.Any, 0);
socket.ReceiveFrom(VSDpacket, ref remoteEndPoint); //throw an exception with
message "an invalid argument was supplied".
Thanks a lot!
Lionel