Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TCP P2P without server

is it possible to write TCP P2P program without server? When I was googling this question I found something about NAT traversal,UPnP, can I use them somehow?

like image 736
user380798 Avatar asked Aug 02 '10 21:08

user380798


People also ask

Do you need a server for P2P?

A peer-to-peer network is one in which two or more PCs share files and access to devices such as printers without requiring a separate server computer or server software.

Does P2P use a server?

P2P (peer-to-peer) networks are used for distributing files on a network. On a P2P network, each computer acts as both a server and a client, storing and sharing files with other computers on the network.

Does P2P use TCP?

Six out of nine analyzed P2P protocols use both TCP and UDP as layer-4 transport protocols. These protocols include eDon- key, Fasttrack, WinMx, Gnutella, MP2P and Direct Con- nect. Generally, control traffic, queries and query-replies use UDP, and actual data transfers use TCP.

Does P2P need port forwarding?

So in brief: port forwarding helps with the health of P2P data exchange by making it easier for connections to be established - and unless every member enables port forwarding of some kind, it is impossible to exchange data in a P2P manner.


2 Answers

Yes you can (where as GrandmasterB points out, each peer has both server and client sockets). However, NATs will cause you pain, as you may already know.

If you can't use middleboxes (servers on public IP addresses to which your clients connect (*)) - and you might not want these, because they're rather contrary to the point of P2P - and you don't mind describing your connection details with SDP, you could try Interactive Connectivity Establishment.

Essentially, ICE tries different strategies to connect. It's a pluggable architecture, so you could add your own custom strategies. By default ICE describes techniques for UDP traversal, but an extension to allow TCP connectivity is in the works.

(*) You could always try an architecture like IRC, where you have any number of servers peering amongst themselves, to which clients connect. That's halfway to P2P at least. (This is also pretty much the architecture SIP uses.)

like image 177
Frank Shearar Avatar answered Sep 28 '22 06:09

Frank Shearar


It really depends what you mean by 'server'. You dont need a centralized server by any means. The term 'p2p', by its very definition, implies no centralized server.

But the apps that receive data from other apps need to be able to listen for incoming tcp/ip connections... thats typically considered 'server' functionality, even if you arent calling it a 'server'. So in your case, your p2p app would need to have both server and client (initiating connections) capabilities built into it.

like image 40
GrandmasterB Avatar answered Sep 28 '22 08:09

GrandmasterB