Hi David, On 9/25/2019 1:08 AM, David Storrs wrote:
udp-receive! is giving me unexpected results when my local machine -> router -> server shows the UDP port of the process running on the local machine instead of the one from the router. I'm not sure how to get the router's port instead.
NAT routing is transparent: you are - or at least, should be - seeing the port number of the remote machine.
But remember that - unlike TCP - UDP can send on the same port that it listens to. If the "client" is sending on the same port as the server is listening, you won't be able to distinguish them by port alone.
The AWS server does this: (define-values (len senders-host senders-port) (udp-receive! socket buffer)) What I'm actually getting is: senders-host: <public IP address of my router> senders-port: 25890 ; this is the UDP port bound by the process on the local machine What I'm expecting is: senders-host: <public IP address of my router> senders-port: <port number that my router chose when it relayed the message from my machine to the AWS server>
You won't get the address of the router - you'll get the address of the client. (see below)
I've been digging through the RFCs for UDP and Traditional NAT (https://www.ietf.org/rfc/rfc768.txt and https://www.ietf.org/rfc/rfc3022.txt) to make sure that I haven't randomly gotten confused about how routers work but it seems to be what I recall: The local machine sends to the router using the port number 25890, the router rewrites it to an arbitrary port number chosen on the fly, the AWS server sees the router's assigned port and not 25890. What am I missing here? I'm sure it's something embarrassingly obvious.
What you are overlooking is that UDP is a level 4 [end-to-end] protocol, but you are trying to get level 3 [routing] information.
Neither UDP nor TCP normally records the path a packet takes - only the routers themselves know what they do to forward the packet. The path between 2 machines is never fixed, and it may change abruptly due to congestion or outage along the way. "traceroute" uses a special (level 3) IP packet which explicitly commands each router along the way ... and the end destination as well if the packet gets there ... to send back a response to the traceroute initiator. The path is discovered dynamically from the responses.
Hope this helps, George -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/a0373ae3-5246-8b06-ea58-6689059d4d3c%40comcast.net.