ALL NAT gateways should support a type of dynamic port mapping. The client(behind the NAT gateway) initiates a connection to a server(outside the NAT gateway). Once this is done, the NAT gateway updates a dynamic table that''s similiar to a routing table, saying that client IP [xxx.xxx.xxx.xxx] on port [xx] is communicating with a server IP [yyy.yyy.yyy.yyy] on port [yy].
The IP header has a source IP of the client and a destination IP of the server when it leaves the client computer. When it passes through the NAT gateway, the NAT gateway strips out the source IP address, and changes it to the external (valid internet IP) address of the NAT gateway. So when it gets to the server computer, the server computer thinks the source address is the external IP of the NAT gateway.
The server then sends traffic to this IP address. When this packet is received at the NAT gateway, the gateway looks up the source address (which is the server) in the table to see if there is an existing ''connection'' already initiated (connection meaning prior traffic, not session in TCP terms). If there is such a session, then the packet is forwarded to the internal machine based on the lookup performed against the NAT Gateway''s table.
So in your application, it''s best if you don''t send what you think is the local client address, and just figure all of that out via winsock''s recvfrom address.
That help any?
NAT yet again
Thanks Jon, that pretty much confirms what I thought. Now I just need to figure out why the heck my UDP packets aren't getting through.
And by the way, I did change my UDP port to 5631 (pcAnywhere's UDP port #) with no change.
[edited by - Dr Pain on April 12, 2002 8:12:43 PM]
And by the way, I did change my UDP port to 5631 (pcAnywhere's UDP port #) with no change.
[edited by - Dr Pain on April 12, 2002 8:12:43 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement