android socket programming behind a router

后端 未结 2 1633
攒了一身酷
攒了一身酷 2021-01-12 08:09

I have a question or problem. I am trying to make a p2p connection between two android phones. I have each phone connect to my server and I get their private (192.168.1.1) a

2条回答
  •  天涯浪人
    2021-01-12 08:26

    "My question is if that is true and if so how does LogMeIn or the other p2p applications work behind different routers?"

    The difference here is that the connections for both machines keep going thru the central server - they don't connect directly to each other (except for special cases).

    What you want to do does not work, by design. If TCP could do that, then anyone could connect to anyone.

    You need to make your central server pass the traffic from one phone to the connection the other phone has made with the server.

    Or set up a VPN, or use Google Chrome to phone (name may have changed) which is a means to send small messages to phones, regardless of network topology.

提交回复
热议问题