How do applications listen on the local network on the Internet?

I was wondering how an application like skype (a popular chat client) works on a local network with a single router, how can it listen on a specific port?

for example: = In the same network A and B there are two machines running skype, the gateway is G1,

Now, how A and B will have the same IP address on the Internet as G1, but how can they guarantee that they are listening on different ports? How can they request a G1 router for a unique port.

I want to create a simple text chat server on linux. How can I establish connections between two different computers on two different networks?

+3
source share
5 answers

  • , A , B

  • UDP, . . - . , . INADDR_BROADCAST (255.255.255.255) , , ( , DHCP).

  • (Rendezvous) . , . IRC, Voip, IM " ".

, , . . NAT, .

Rendezvous, . A , , , , B, .

-. DMZ, , UPnP. DMZ IP-. IP-. UPnP , , , rendezvous, .

, , , , , , . , , -, DMz, UPnP .

NAT, , .

- "" .

+1

- - .

. -, Skype, , IP- .
: "" "". , "" , , .

, , , , , , , , , . , .

+2

NAT- NAT-. , HTTP SMTP, , NAT-. NAT , , NAT .

Windows XPs - NAT Traversal, NAT UPnP UPnP NAT. NAT Traversal , UPnP IP- NAT- UPnP NAT.

NAT Traversal . , NAT, UPnP, :

-

UPnP, ICS Windows XP .

+1
source

If A and B do not actually “listen” for outgoing requests, your router must be configured to forward the appropriate port numbers to the appropriate hosts. This is not something you can ask for in code, this is what you need to configure on the router itself.

0
source

Source: https://habr.com/ru/post/1727606/


All Articles