Advertisement

peer-to-peer and opening ports

Started by January 27, 2005 09:11 PM
2 comments, last by wyrzy 20 years ago
Hello, Is it possible to make a program that has a true peer-to-peer network environment where neither machine would have to open up specific ports through port forwarding or other (outside of the program's code) means?
You mean, if one or both of the machines are behind a firewall, and/or have a non routable IP? In this case I would guess there is no way, without having a 3rd aprty server to rely the messages between the machines. But if one of the machines has a routable IP and is not firewalled, then that machine can open two connections, one for sending and one for reciving data.
Advertisement
If both machines are behind NAT, but the NAT allows UDP through and do "cone NAT" (i e, are well-conforming NAT implementations), then you can do peer-to-peer communication without bouncing all the data off a third server -- although you still need the third server to initially set up the connection.

Check the Forum FAQ about "introducers" and "NAT punch-through".
enum Bool { True, False, FileNotFound };
Quote:
Original post by hplus0603
If both machines are behind NAT, but the NAT allows UDP through and do "cone NAT" (i e, are well-conforming NAT implementations), then you can do peer-to-peer communication without bouncing all the data off a third server -- although you still need the third server to initially set up the connection.

Check the Forum FAQ about "introducers" and "NAT punch-through".

Following up on what hplus mentioned, you can also do "NAT punch-through" with TCP although I have heard that slightly less NATs allow you to punch through. There is paper on TCP and UDP punch through at http://www.brynosaurus.com/pub/os/nat.pdf and another site at http://midcom-p2p.sourceforge.net/ that contains some information on NAT compatibility with P2P networking over TCP and UDP.

Any yes, you do need a server that has a public IP address to intialize the connections.

This topic is closed to new replies.

Advertisement