Just saw this last night. TinyP2P - The World's Smallest P2P Application http://www.freedom-to-tinker.com/tinyp2p.html 15 lines of Python code. Written to "to illustrate the difficulty of regulating peer-to-peer applications." So, remember kids, wear your white hat when programming. =];-{i Dean
Dean Lake wrote:
Just saw this last night.
TinyP2P - The World's Smallest P2P Application http://www.freedom-to-tinker.com/tinyp2p.html
15 lines of Python code. Written to "to illustrate the difficulty of regulating peer-to-peer applications."
So, remember kids, wear your white hat when programming. =];-{i
Dean
I'm having a hard time getting it to work; it keeps telling me that it's iterating over a non-sequence. I guess this means that the object isn't a list or a tuple or anything like that. I think that means there's only one host, which is to be expected. I'm trying to do it with 127.0.0.1 or my local router-created network, but neither work. I tried setting up a second server on the same machine (connected to that same network), but it failed for the same reason. Can you get it to work? Tim -- Visit my website: (and please be a supporter of free trade, free software, phr33 s0ftware, free dom, and free propoganda by giving others the url) http://kmg.is-a-geek.org Garunteed to be down at least 5% of the time.
I'm having a hard time getting it to work; it keeps telling me that it's iterating over a non-sequence. I guess this means that the object isn't a list or a tuple or anything like that. I think that means there's only one host, which is to be expected. I'm trying to do it with 127.0.0.1 or my local router-created network, but neither work. I tried setting up a second server on the same machine (connected to that same network), but it failed for the same reason. Can you get it to work?
Tim
Hi Tim -- Too lazy to reboot the Compaq into Mandrake 9.2, I'm trying this in Windows. I downloaded the code to a Python 2.4 subdirectory (site-packages) and inserted a few carriage returns for readability (didn't help much -- these little lambda people might be happier in Scheme). Then I opened a cmd window and went to said subdirectory and entered: --- Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\Kirby>d: D:\>cd python24 D:\Python24>cd Lib D:\Python24\Lib>cd site-packages D:\Python24\Lib\site-packages>python tinyp2p.py shazam server ktu2 6789 --- So far so good. Then I opened a second command window went to my c:\temp subdirectory and entered: --- Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\Kirby>cd temp The system cannot find the path specified. C:\Documents and Settings\Kirby>cd\ C:\>cd temp C:\temp>d:\python24\python d:\python24\Lib\site-packages\tinyp2p.py shazam client http://ktu2.6789 * And what I got back was: Traceback (most recent call last): File "d:\python24\Lib\site-packages\tinyp2p.py", line 26, in ? for url in pxy(ar[3]).f(pw(ar[3]),0,[]): File "d:\python24\lib\xmlrpclib.py", line 1096, in __call__ return self.__send(self.__name, args) File "d:\python24\lib\xmlrpclib.py", line 1383, in __request verbose=self.__verbose File "d:\python24\lib\xmlrpclib.py", line 1129, in request self.send_content(h, request_body) File "d:\python24\lib\xmlrpclib.py", line 1243, in send_content connection.endheaders() File "d:\python24\lib\httplib.py", line 792, in endheaders self._send_output() File "d:\python24\lib\httplib.py", line 673, in _send_output self.send(msg) File "d:\python24\lib\httplib.py", line 640, in send self.connect() File "d:\python24\lib\httplib.py", line 608, in connect socket.SOCK_STREAM): socket.gaierror: (11001, 'getaddrinfo failed') C:\temp> --- Am I going to now try to debug this giant mess just so I can prove Python is able to do peer to peer (which I already knew)? No. Do I think someone else might get this to work on Win XP? Definitely. Do I think Win XP is part of the problem somehow? I really have no idea. BUT WAIT! Now that I'm eyeballing all of the above, I see that I have some silly dot instead of a colon after the ktu2 in the URL. Let's try that again: --- C:\temp>d:\python24\python d:\python24\Lib\site-packages\tinyp2p.py shazam client http://ktu2:6789 * Traceback (most recent call last): File "d:\python24\Lib\site-packages\tinyp2p.py", line 26, in ? for url in pxy(ar[3]).f(pw(ar[3]),0,[]): File "d:\python24\lib\xmlrpclib.py", line 1096, in __call__ return self.__send(self.__name, args) File "d:\python24\lib\xmlrpclib.py", line 1383, in __request verbose=self.__verbose File "d:\python24\lib\xmlrpclib.py", line 1147, in request return self._parse_response(h.getfile(), sock) File "d:\python24\lib\xmlrpclib.py", line 1286, in _parse_response return u.close() File "d:\python24\lib\xmlrpclib.py", line 744, in close raise Fault(**self._stack[0]) xmlrpclib.Fault: <Fault 1: 'exceptions.TypeError:coercing to Unicode: need string or buffer, list found'> --- OK, well, definite progress anyway. This is a completely different error. I just had my URL borked in the top example. Maybe I just don't know what a pattern should look like. I tried * for "everything," then I tried "py". But look, even though both tries got me tracebacks, the server is now registering that it's getting hits: --- [beneath the earlier server command line] KTU2 - - [17/Dec/2004 09:02:34] "POST /RPC2 HTTP/1.0" 200 - KTU2 - - [17/Dec/2004 09:03:05] "POST /RPC2 HTTP/1.0" 200 - --- I feel a lot closer to having it work. On the other hand, I have no more incentive to try *making* it work. Off to other things. Kinda fun though. Kirby
-- Visit my website: (and please be a supporter of free trade, free software, phr33 s0ftware, free dom, and free propoganda by giving others the url) http://kmg.is-a-geek.org Garunteed to be down at least 5% of the time.
_______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig
participants (3)
-
Dean Lake
-
Kirby Urner
-
The Bauman Family