How to establish Peer to Peer communication without port forwarding?

0

My ISP provides me a local static IP address. How can I establish a connection with another computer in the internet without having a public IP address? I just want to make a simple application which can send data back and forth to another computer outside my local network. I know a little about port forwarding, but unfortunately my ISP cannot port forward for me. Is it really possible without port forwarding? How? Thanks.

muntasir2000

Posted 2014-03-21T08:56:31.277

Reputation: 22

Have you checked if UPnP works? UPnP is a protocol for port forwarding, and if you're lucky, it works even if the ISP doesn't tell you about it. – nitro2k01 – 2014-03-21T09:31:21.763

Answers

1

If the other party can set up port forwarding (or doesn't use NAT), you're all done. A TCP connection is always duplex-capable.

If that's not possible, you could resort to "Hole Punching", a technique that tricks NAT devices into allowing an "incoming" connection, with the help of a universally reachable third party.

Taken from the linked article, the basic principle:

    • Peer A sends a SYN to Peer B
    • Peer B sends a SYN to Peer A
    • When NAT-a receives the outgoing SYN from Peer A, it creates a mapping in its state machine.
    • When NAT-b receives the outgoing SYN from Peer B, it creates a mapping in its state machine.
  1. Both SYN cross somewhere along the network path, then:

    • SYN from Peer A reaches NAT-b, SYN from Peer B reaches NAT-a
    • Depending on the timing of these events (where in the network the SYN cross), at least one of the NAT will let the incoming SYN through, and map it to the internal destination peer
  2. Upon receipt of the SYN, the peer send a SYN+ACK back and the connection is established.

Daniel B

Posted 2014-03-21T08:56:31.277

Reputation: 40 502