Take the 2-minute tour ×

There are two clients and interact with a server.

At some point the server sends the clients information about each other in order to make a connection.

The two clients make a socket connection to each other to exchange data directly without going through the server.

Is this a P2P connection?

share|improve this question
If two peers (which are either both servers or clients) connect, they make a peer to peer connection. –  Dan D. Apr 18 '12 at 2:12
add comment

3 Answers

Yes, that is a P2P connection. For more reading, see: http://en.wikipedia.org/wiki/BitTorrent_(protocol)

share|improve this answer
What if the server tells the two clients which one will be the server, and which one will be the client, in order for them to make a connection? The is it still P2P? –  tony_sid Apr 18 '12 at 2:42
I'd say so, because they're still connecting to each other. No matter what, one of them has to go first. The P2P comes from two machines that are peers connecting to each other. –  Mark Allen Apr 18 '12 at 3:20
add comment

What you just described is called "Hole Punching". It can be done with both TCP and UDP protocols. This article is really great at explaing how this works:

After this is done, the peers can communicate with each other. This method requires a central server to initialize the connection. However, It sounds like you've done at least a little research into this.

share|improve this answer
add comment

The terms "client," "server," and "peer-to-peer" are all a bit ambiguous and borders between them are blurred.

A given entity X that is a server generally does not initiate connections, but waits for clients to talk to it. Conversely, clients do not listen for connections, but initiate connections toward a specified or discovered server.

Peer to peer would be where X can either initiate or receive connections.

Now X here can be a process, or part of a process, or a thread of a process, etc. but it should all be the same service. Sometimes a process or program is a client of one type of service and then a server of another. So this would not really be "peer-to-peer" but just a program that is both a client (of one type) and a server (of another type).

In the example you provide, there are two things going on, a discovery process, and then a data transfer process. So you have two different protocols, or parts of protocols, going on. Most everything that is "peer-to-peer" is sort of hybrid like this, and even though the peers can trade data without the assistance of a server, they still need something like a server for discovery.

share|improve this answer
add comment

Your Answer


