A quick question for the networking gurus out there -
UDPSocket.ReceiveFrom(inBuffer, ref RXEndPoint);
My understanding of the EndPoint pass by reference is that infomation regarding the incoming packet is updated in the passed EndPoint. In this case the IP address of the incoming packet is what I am interested in.
RxIP = (RXEndPoint as IPEndPoint).Address;
Using the code snippet above I can access the Address property. However it points at the original values that the EndPoint was configured with (IPAddress.Any, 10000).
I understand that if the connection protocol was TCP and it was connected it would return the IPEndPoint of the remote connection. In this case though I am using UDP.
Short of implementing a complete Raw socket handler (Something I don’t have the time or knowledge to do ) is there a way to find out what the IP address of the incoming UDP packet? (IPHeader info that the UDP packet was framed in)
I’ve also noted the complete lack of a UDPClient class (System.Ext.Net… etc…) Is this something that will be coming to .NetMF 4.x?
I usually do not use the Poll() method, since I use an infinite wait.
Does the problem show up after the first ReceiveFrom() or later? After the first receive, RXEndPoint will be set to a remote address/port, and all future ReceiveFrom() will be waiting for packets from that host only.
I would use:
EndPoint ep = RXEndPoint;
ReceiverFrom(…, ref ep);
This way, RXEndPoint keeps the correct values, and the reference within EP will be changed to the remote end.
I don’t have time right now to load your code and see what is happening in more detail.