Archived

This topic is now archived and is closed to further replies.

UDP behind NAT

This topic is 5275 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Idea on what? Just setting the NAT tables on the router will fix any problem you might have, you can choose between UDP and TCP for those routes too.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The client needs to initiate the connection first in order for the NAT to make the mapping between the NAT''s wan port and the client''s port. Otherwise the server can''t tell which port the NAT has opened (if any) to the client''s UDP port. The mapping will hold for about 20-30 seconds after the last sent message; after that the mapping is removed. So you need to come up with a ''ping'' message protocol you need to exchange on a frequent basis to maintain the port mapping alive.

Share this post


Link to post
Share on other sites
I''d try to initialize a UDP connection from client to server, server can receive the client message. When the server reply acknowledge message to that client. It cannot receive the message anyway by the information received by function "recvfrom" in the server ....

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Well, using a debugger and stepping slowly in the code is a sure way to make the NAT close up. Using a different socket for the reply route is another way.

Setting up static UDP routes involves changing the NAT configuration, which was stated can''t be done from the server.

Share this post


Link to post
Share on other sites