c++ - socket with external and internal ip address -


i know text messenger apps likes whatsapp got network problem this

a chat program in pc :

server(1.2.3.5) router a(1.2.3.4) router b(1.2.3.6)

under router there have 2 computer a(192.168.0.2) b(192.168.0.3)

under router b there have 2 computer c(192.168.0.4) d(192.168.0.5)

when d want connect a, send msg server, , server forward msg a, , router(1.2.3.4) need set port forward rules example chat program use port 999 when server send msg 1.2.3.4:999 router(1.2.3.4) forward msg a(192.168.0.2:999), can set router setting on pc

but when using phone , connect wifi external ip of phone changed , assign internal ip, can't make port forward rules on router how can text messenger(or whatsapp) work network?

the server needs communicate machine on different subnet. have 2 choices:

  • have client initiate connection server. how skype works, example. once client connected, server can send data it.

  • have client forward known port on router using upnp. this, however, requires server know port , host in advance. except specific applications (such bittorrent), not possible.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -