How does a client establish a peer-to-peer connection?
Asked Answered
L

1

6

It is common that (game)clients establish a p2p connection to reduce the latency and the load on the server.

But how do they do that?

Here an example: I open my League of Legends client. Press on "Play". Then my client sends the request to the server to find a game. Then the server responds with a list of players (ip addresses?). My client now connects to each player to reduce the ping.

And this is what confuses me. I and many other players are sitting behind a NAT. So maschines from the internet can only send data to my computer if i forward a port on my router or when i send data to a accessible server (open a website, send a request to the game server).

Me and my opponent have the ip address of each other but we can't connect to each other because our routers are blocking the connection.

Liriodendron answered 27/2, 2012 at 14:24 Comment(0)
C
3

Wikipedia has a description of UDP hole punching which gives you an idea how it can be done. The article has some additional links. If nothing else works, the peers have to use a relay.

Capacitor answered 27/2, 2012 at 15:58 Comment(1)
do other services like xbox live or torrent use the same technique?Liriodendron

© 2022 - 2024 — McMap. All rights reserved.