[p2p] p2p file sharing
[1/7] from: gchiu:compkarori at: 19-Jun-2004 10:38
I would like to see if anyone is interested in collaborating on developing a simple p2p
file sharing system. I have grafted a few functions onto Andreas' xmlrpc code to implement
the concept.
Here's an example .. the server code is running on a PC behind NAT
First, get the xmlrpc code which I've built here
do load-thru http://www.compkarori.com/reb/xmlrpc.r
or get it from the official distro here http://earl.strain.at/space/rebXR
Now, get the directory of files I am sharing...
xmlrpc-exec http://www.compkarori.co.nz:8001 [ getDirectory ]
== ["doc-bar.gif" "encap.png" "made-sdk.png" "made-sdk100.gif" "pwr-reb-tech.png" "pwr-reb-tech100.gif"
"pwr-rebol.png" "pwr-rebol1...
Lets get the details of a single file
xmlrpc-exec http://www.compkarori.co.nz:8001 [ getFileData "doc-bar.gif" ]
== [4233 18-Jun-2004/23:14:42 "EAD073F6F368EAEBFAEB398353073223"]
which says the file is 4233 bytes long, has the above date stamp, and md5 checksum
Now to download a file:
data: xmlrpc-exec http://www.compkarori.co.nz:8001 [ getFileBits "doc-bar.gif" 1 4233
]
This one is small enough to get at one go. We specify that it will start at byte 1,
and we are requesting 4233 total bytes. For multimegabyte files, you would fetch them
in, say 4k blocks.
We can now use the md5 to check that the file has been transferred correctly. Or, we
can just look at it
i: load data
view layout [ image i ]
Server code is here:
http://www.compkarori.com/reb/rp2p.r
It's just a concept demonstration at present. For multimegabyte files, we are thinking
of splitting them up on the server to make it easier to send but this is to be transparent
to the client.
Discussion is hosted at "Rebol World" AltIOS channel ( using an AltME client )
Use guest/guest if you don't already have an account...
--
Graham Chiu
http://www.compkarori.com/cerebrus
http://www.compkarori.com/rebolml
[2/7] from: gchiu:compkarori at: 21-Jun-2004 10:56
An update here.
Using the client at
http://www.compkarori.com/reb/rp2pclient.r
I can transfer a 3.6Mb mp3 file in 7 mins locally ( same city ) and I think someone
else said it took 15 mins from NZ to the USA.
If you want to grab the server source, it's called %viewserver.r and is available using
the client :) If you set up a "server", please change the name so it's not "Graham"
...! If you're behind NAT, you need to setup port forwarding and open a pinhole for
the port you choose.
Ok, xmlrpc wasn't intended for file transfer but heck, it works! The client supports
file resume if it encounters a network error.
If someone wanted to, you could also produce stats on speed of data transfer and display
them... but really the idea is to transfer source code for collaboration if you don't
have IOS.
The intent is that the client and server will be combined to make it true p2p ...
--
Graham Chiu
http://www.compkarori.com/cerebrus
http://www.compkarori.com/rebolml
[3/7] from: Izkata::comcast::net at: 20-Jun-2004 20:17
** Script Error: attempt has no value
** Where: func [face value][attempt [view-directory face/text]]
** Near: attempt [view-directory face/text]
>>
I've been doing all I can to get my friends at school to get
interested in Rebol (I'm getting closer >.<), but when I tried
to connect and get the ViewServer.r file, that popped up...
I believe I'm using the most recent version of View for Windows,
and it has no definition for "attempt".. Any help?
----- Original Message -----
From: "Graham Chiu" <[gchiu--compkarori--co--nz]>
To: <[rebolist--rebol--com]>
Sent: Sunday, June 20, 2004 5:56 PM
Subject: [REBOL] [p2p] p2p file sharing
> An update here.
>
> Using the client at
>
> http://www.compkarori.com/reb/rp2pclient.r
>
> I can transfer a 3.6Mb mp3 file in 7 mins locally ( same city ) and I
think someone else said it took 15 mins from NZ to the USA.
> If you want to grab the server source, it's called %viewserver.r and is
available using the client :) If you set up a "server", please change the
name so it's not "Graham" ...! If you're behind NAT, you need to setup port
forwarding and open a pinhole for the port you choose.
> Ok, xmlrpc wasn't intended for file transfer but heck, it works! The
client supports file resume if it encounters a network error.
> If someone wanted to, you could also produce stats on speed of data
transfer and display them... but really the idea is to transfer source code
for collaboration if you don't have IOS.
[4/7] from: greggirwin:mindspring at: 20-Jun-2004 21:01
Hi Izkata,
I> I believe I'm using the most recent version of View for Windows,
I> and it has no definition for "attempt".. Any help?
It's at least in 1.2.8, not sure how much farther back.
attempt: func [
{Tries to evaluate and returns result or NONE on error.}
value
][
if not error? set/any 'value try :value [get/any 'value]
]
-- Gregg
[5/7] from: gchiu:compkarori at: 21-Jun-2004 15:32
Izkata wrote.. apparently on 20-Jun-2004/20:17:46-5:00
>** Script Error: attempt has no value
>** Where: func [face value][attempt [view-directory face/text]]
>** Near: attempt [view-directory face/text]
>>>
That must be a very old version of view. Here's the source to 'attempt to get u going:
attempt: func [
{Tries to evaluate and returns result or NONE on error.}
value][
if not error? set/any 'value try :value [get/any 'value]
]
Rebol.net is where to get the current betas, but I believe that's down.
--
Graham Chiu
http://www.compkarori.com/cerebrus
http://www.compkarori.com/rebolml
[6/7] from: philb:upnaway at: 21-Jun-2004 11:42
Hi
attempt is certainly defined from view 1.2.5 onwards.
Are you sure there is nothinig in your user.r that is un-setting it?
REBOL/View 1.2.5.3.1 6-May-2002
Copyright 2000-2002 REBOL Technologies. All rights reserved.
REBOL is a trademark of REBOL Technologies. WWW.REBOL.COM
......
......
>> attempt
** Script Error: attempt is missing its value argument
** Near: attempt
Phil
[7/7] from: gchiu:compkarori at: 23-Jun-2004 12:20
Izkata wrote.. apparently on 20-Jun-2004/20:17:46-5:00
>I believe I'm using the most recent version of View for Windows,
>and it has no definition for "attempt".. Any help?
I just downloaded the latest view for Windows that isn't a beta, and you're correct :(
Hope Carl can get rebol.net up soon ...
--
Graham Chiu
http://www.compkarori.com/cerebrus
http://www.compkarori.com/rebolml