Slashdot Mirror


P2P In 15 Lines of Code

nile_list writes "Edward Felten of the very fine Freedom to Tinker has written a 15 line P2P program in Python. From the post on Freedom to Tinker, "I wrote TinyP2P to illustrate the difficulty of regulating peer-to-peer applications. Peer-to-peer apps can be very simple, and any moderately skilled programmer can write one, so attempts to ban their creation would be fruitless." Matthew Scala, a reader of Freedom to Tinker, has responded with the 9 line MoleSter, written in Perl."

11 of 418 comments (clear)

  1. Re:Not a good true complexity issue. by wwahammy · · Score: 5, Insightful

    The point is that a person/entity can create a P2P program with a very small amount of custom code. If someone is going to ban P2P for "inducing" copyright infringement, they'd look stupid for banning a program this small or they'd have to ban the libraries that are used too which is pretty unlikely.

  2. Re:Not a good true complexity issue. by grub · · Score: 5, Insightful


    A p2p app is pretty pointless without a network stack but no one counts that as part of the app or supporting code. Don't pick the nits too much.

    --
    Trolling is a art,
  3. Re:Not a good true complexity issue. by Abcd1234 · · Score: 5, Insightful

    Umm, you're missing the point. The fact is with commonly available tools, and I'd consider Perl and Python (or Java) with their massive stock libraries "commonly available", one can easily write a p2p app (heck, BitTorrent is written in Python, so I think it's a very valid example).

    Hell, by your logic, the following application:

    int main(int argc, char **argv)
    {
    printf("Hello World");
    }

    is cheating, since I'm using printf, and god knows how complicated that call is, not to mention all the code in the OS to make the text appear on stdout!

  4. Re:P2P Does Not Break the Law by Anonymous Coward · · Score: 5, Insightful

    The point is that when copyright holders attempt to take action against those people, you all start crying "They're suing children!" So they sue the P2P networks instead, and you start crying "Unfair! Go sue the users!" So they...

  5. Re:Not a good true complexity issue. by dtolton · · Score: 5, Insightful

    I think you are missing the point. The point isn't that you can write a library called p2p and write a a two line python program:

    import p2p

    p2p.run()

    the point is that using standard built in libaries of these languages you can build a fully working p2p system in a very short amount of code.

    I do agree though that 15 lines is a bit misleading, although the python program is not putting multiple statements on one line, you can't do that in python. Instead he has removed all whitespace, put all defs and the following body on one line etc.

    Again though, the point *isn't* trying to make a program that is highly "pythonic", it isn't. The point is that using basic libraries that have been in Python for years, you can roll a p2p server in 20 minutes.

    --

    Doug Tolton

    "The destruction of a value which is, will not bring value to that which isn't." -John Galt
  6. He could be liable... by vivin · · Score: 4, Insightful

    But according to this article from a story that was posted on Slashdot yesterday:

    But if next July's anticipated Supreme Court ruling in the MPAA/RIAA vs Grokster/Streamcast goes in favour of the movie and music industries, the heat is going to be on any technology, no matter how benign the intentions of its developer, that nevertheless makes piracy possible.

    Which is rather stupid and obtuse. If you're trying to pioneer a novel way to transfer data, then it could be used for piracy. Anything that transfers bits and bytes around can be held liable. So setting this precedent is just PLAIN STUPID. How far will *AA go? Let's say this precedent had already been established... then they could go after Brian Cohen. They could hold him responsible for create an application "makes piracy possible, regardless of his benign intentions". This way the *AA could crush anything that they see as a potential threat.

    --
    Vivin Suresh Paliath
    http://vivin.net

    I like
    1. Re:He could be liable... by raehl · · Score: 4, Insightful

      This way the *AA could crush anything that they see as a potential threat.

      Hrm... like an operating system that enables file duplication and networking?

  7. Re:Not a good true complexity issue. by CableModemSniper · · Score: 4, Insightful

    #!/UpperlevelProgrammingLanguage
    Import webserver
    Run Webserver
    ----
    What, like this?
    #!/usr/bin/env ruby
    require 'webrick'
    s = WEBrick::HTTPServer.new( :Port => 80, :DocumentRoot => File.join(Dir.pwd, "htdocs")
    trap("INT") { s.shutdown }
    s.start

    --
    Why not fork?
  8. Re:Not a good true complexity issue. by Jerf · · Score: 5, Insightful

    While what you say is true, I think you are partially missing the point, because what you say is part of the point.

    None of the components included in the Python program are specifically P2P. But each of these components are common, powerful, and widely available; almost every, if not every, mainstream language you can think to name has each of these libraries easily available. This isn't news to Prof. Felten, it's an integral part of his point: These readily available libraries, for which no reasonable grounds can be come up with to eliminate them, are trivially combined into a P2P program.

    It is not the same as "import webserver; webserver.run()".

    Moreover, there is nothing XML-RPC or HMAC specific about the code, really, and you can't ban all RPC libraries, all hashing libraries, etc.

    This isn't really a demonstration of the power of Python or anything, and I think Molester sort of misses that point, though turning it into a Perl Golf contest is cool and nerdy and all. (Besides, Pythonistas like me are generally not impressed with such hyper-concision, since one of the reasons we use Python is readability and maintainablity; as a game it is great fun though.) Prof. Felten's point needs to be understood more like an academic proof that a problem is intractable; reduce the problem to something like the halting problem with a 1-to-1 mapping, and you're done. Here, Ed Felten reduces "P2P" to (taking it generically) a language and OS (absolutely vital, can't be banned without banning computers entirely), networking/communication, a bit of string processing (re is convenient but any turing complete language can do that), and a hashing algorithm which probably isn't even vital to the process.

    The point is to show that at the core, P2P can't be banned because there really isn't a "P2P" technology, it is an incredibly simple and straightforward application of the basic capabilities of a computer and a network connection. It has already been shown a rough equivalent can be written in Perl, and any number of others will probably pop up now. Languages like C++ or Java probably can't get down to 10 lines, but they will still be simple programs as programs in those languages go.

  9. Unlikely? by simpl3x · · Score: 4, Insightful

    Until it's required to have DRM in the OS... And, bans on malicious code... Perhaps a ban on compilers...

    Unlikely isn't the word I'd use when we have people who have no clue as to what they're talking about. They'd think they were banning viruses!

    Moderate funny ha ha.

  10. Re:P2P only works if there are other peers by dreamchaser · · Score: 4, Insightful

    Do the words 'proof of concept' mean anything to you?