AfterDawn: Tech news

TinyP2P, the world's smallest P2P application

Written by James Delahunty (Google+) @ 06 Jan 2005 21:04

Consisting of just 16 lines of Python code, the worlds smallest P2P application, TinyP2P, was written by Ed Felten, with help from Alex Halderman. Edward W. Felten is a Professor at Princeton University and Alex Halderman is a PhD student in computer science at Princeton University. It was written to prove how easy it is to write a P2P application, and it has shown that any programmer with moderate skills could come up with their own P2P application. For this reason, both men believe that it's near possible to regulate P2P and/or to ban it completely.
The program creates a small-world network, which might be used by a group of friends or business associates to share files. The program does not work well for very large networks; instead, many small networks can coexist. Each network is protected by a password; a network can be accessed only by people who know its password. (But networks are not secure against attackers who can eavesdrop on their traffic.) The program uses the HTTP and XML-RPC communication protocols. The program can be run in either server or client mode. To run it as a server you would have to type the command:

python password server hostname portnum [otherurl]

Here password is the password for the network, hostname and portnum will be used to construct the URL on which the server will listen (http://hostname:portnum), and otherurl (which is optional) is the URL of another server that is already running as part of the network. (Otherurl will be used to hook up your server to the network. If you don't provide an otherurl, the program will assume that your server is starting a new network.) When run as a server, the program connects to a network of other servers, and makes all of the files in the current directory available for downloading by users of the network. To run the program in client mode you would type the command:

python password client serverurl pattern

Here password is the network's password, serverurl is the URL of a server that belongs to the network, and pattern is a character string. This command looks at every file being shared by every server on the network. A file is downloaded, and stored in the current directory, if two things are true: (a) the file's name contains the substring pattern, and (b) there is not already a file of the same name in the current directory.

The TinyP2P code can be downloaded here.


Previous Next  
Comments have been disabled for this article.

Latest user comments

News archive