Client server program behind the router

I am trying to run a UDP client server program. Both my machines are on different networks. I have configured port forwarding in my router.

My server has two IP addresses: 1) External 200 ...? 2) Internal 192.168.0.100

When creating a UDP server, I need to create a socket bound to addresses.

At what address should I bind the socket to external or internal?

I tried with internal address but it doesn't receive any data from client.

Suggestions...

0


source to share


2 answers


Considering the fact that you said you set up port forwarding, did you assign the proper ports in the UPD program? or are you just sending data to the IP address? If you provide an external IP address and port number, port forwarding on your router should send it to the appropriate node on the network.



0


source


If you must bind to a specific address, it will be an internal address and definitely not an external address.

The whole point of NAT on your router is to hide the internal network addressing scheme from the outside world. The NAT algorithm of the router will take care of rewriting the destination IP address in any incoming packet to the correct internal IP address.



That it is not working indicates that something is wrong with your port forwarding and / or firewall on your router. It is not uncommon for you to configure a specific firewall rule to allow traffic in addition to the forwarding rule.

0


source







All Articles