[REBOL] [p2p] p2p file sharing
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
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"
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:
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...