P2P CheatSheet
What is P2P?
It's a general term to describe two machine can communicate directly with each other without an intermediate server. Each machine acts as the server and receiver.
How does P2P communication work?
- There is a central server (Rendezvous Server) used to store all available machines. The central server saves information about each machine available for future P2P connections.
- When two machines knows the information about each other, they try to build the direct communication channel.
- If they're not behind any NAT, this is easy, each acts as the server and client with their unique IPs.
- If they're behind NAT, then they need to tell the router how to set a port-mapping rule so that traffics coming from a particular port can be redirected to them. They achieve this by following protocols that the router may or may not follow, so it is possible a P2P connection is blocked completely.
- Some examples of such protocols include: UPnP, NAT_PMP, STUN, TURN, Hole Punching, ICE.