[JDEV] p2p filetransfer proposal
aliban at gmx.net
aliban at gmx.net
Tue Feb 12 19:45:51 CST 2002
hi,
i just wrote this paper just because i need such a thing quite soon
for my own client.
greetings, Edrin
any comments are welcome!
(maybe i should switch the methode of comparing the filesize to
comparing a file checksum... any idea how to calculate this?)
###############################################
# #
# new File Transfer proposal #
# #
###############################################
# PROJECT HISTORY #
# 12.02.2002 v.1.0 experimental #
# #
###############################################
# #
# This is a description of the XML and TCP #
# part of the file transfer used in #
# combination with jabberFS (jabber File #
# Sharing). #
# The same methodes are used for filetransfer #
# with Skabber, a jabber client for Windows #
# #
# This project is maintained by #
# JID:Edrin at amessage.de #
# #
###############################################
v.1.0 experimental
Faust´s IP: 12.34.56.78
Mephisto´s IP: 66.66.66.66
<connecting/> client wants the other client to open a port
<listening/> client opened a port
<append/> client wants only a part of a file (after byte XYZ)
<filebytesdone>13000</filebytesdone> means that the client has
already 13000 bytes of the file...
<ip></ip> of the </connecting> side should be optional (if you are
in an intranet you could
only fill it with 192.168.0.xy and that would not be helpfull)
<abort/> if one side wants to abort simply send a <abort/> and
both sides will cleanup.
jabberFS is a component for jabberd i´m writing soon. it will store
filenames in a mysql database
id="file_1" should be associated with a socket
the listening should have a timeout. if the listening socket timeouts
(nobody connected)
it should send <timeout/>
<iq type="result" to="Mephisto at goethe.de" id="file_1">
<query xmlns="jabber:iq:oob">
<timeout/>
</query>
</iq>
if the </timeout> occures this might be caused because someone
is behind a firewall and does not know it.
you might automatically switch the connecting/listening side,
please contact me about this case so we can discuss and
develp this event.
a running filetransfer can simply be stoped by closing the socket.
no further xml exchange would be
neccessary.
/******************************************************************/
SEND A FILE TO SOMEONE
/******************************************************************/
1. SEND_PROPOSAL
Faust wants to send a file to Mephisto
<iq type="set" to="Mephisto at goethe.de" id="file_1">
<query xmlns="jabber:iq:oob">
<connecting/>
<ip>12.34.56.78</ip>
<filename>my_girl.jpg</filename>
<filesize>35012<filesize>
<desc>A cool girl i met yesterday.</desc>
</query>
</iq>
2.a ACCEPT SEND_PROPOSAL
Mephisto accepts the file
<iq type="result" to="Faust at goethe.de" id="file_1">
<query xmlns="jabber:iq:oob">
<listening/>
<ip>66.66.66.66</ip>
<port>6666</port>
<filename>my_girl.jpg</filename>
<filesize>35012<filesize>
<desc>A cool girl i met yesterday.</desc>
</query>
</iq>
Mephisto accepts the file and indicates that he has already 13000
bytes of it.
He is listening on port 6666 and He will append the remaining
35012-13000 bytes
to the part of the file he already has. He will close the tcp
connection on port
6666 after he received the 35012-13000 bytes.
<iq type="result" to="Faust at goethe.de" id="file_1">
<query xmlns="jabber:iq:oob">
<listening/>
<append/>
<ip>66.66.66.66</ip>
<port>6666</port>
<filename>my_girl.jpg</filename>
<filesize>35012<filesize>
<filebytesdone>13000</filebytesdone>
<desc>A cool girl i met yesterday.</desc>
</query>
</iq>
Mephisto is behind a firewall and responds with a connect
indicating that Faust
must create a listening socket.
<iq type="result" to="Faust at goethe.de" id="file_1">
<query xmlns="jabber:iq:oob">
<connecting/>
<append/>
<ip>66.66.66.66</ip>
<filename>my_girl.jpg</filename>
<filesize>35012<filesize>
<filebytesdone>13000</filebytesdone>
<desc>A cool girl i met yesterday.</desc>
</query>
</iq>
<iq type="set" to="Mephisto at goethe.de" id="file_1">
<query xmlns="jabber:iq:oob">
<listening/>
<append/>
<ip>12.34.56.78</ip>
<port>1234</port>
<filename>my_girl.jpg</filename>
<filesize>35012<filesize>
<filebytesdone>13000</filebytesdone>
<desc>A cool girl i met yesterday.</desc>
</query>
</iq>
2.b DECLINE SEND_PROPOSAL
Mephisto does not want this file.
<iq type="result" to="Faust at goethe.de" id="file_1">
<query xmlns="jabber:iq:oob">
<abort/>
</query>
</iq>
/******************************************************************/
GET A FILE FROM SOMEONE
/******************************************************************/
1. GET_PROPOSAL
Faust wants to get a file from Mephisto
<iq type="get" to="Mephisto at goethe.de" id="file_1">
<query xmlns="jabber:iq:oob">
<connecting/>
<ip>12.34.56.78</ip>
<filename>song_hell.mp3</filename>
<desc>standart jabberFS file request</desc>
</query>
</iq>
2.a ACCEPT GET_PROPOSAL
Mephisto accepts it and offers the file on port 6666.
<iq type="result" to="Faust at goethe.de" id="file_1">
<query xmlns="jabber:iq:oob">
<listening/>
<ip>66.66.66.66</ip>
<port>6666</port>
<filename>song_hell.mp3</filename>
<filesize>3050122<filesize>
<desc>standart jabberFS file request</desc>
</query>
</iq>
1. GET_PROPOSAL_RESUME (resume broken file)
Faust wants to get a file from Mephisto. He has already 66000
bytes of the
3050122 bytes big file.
<iq type="get" to="Mephisto at goethe.de" id="file_1">
<query xmlns="jabber:iq:oob">
<connecting/>
<append/>
<ip>12.34.56.78</ip>
<filename>song_hell.mp3</filename>
<filesize>3050122<filesize>
<filebytesdone>66000</filebytesdone>
<desc>standart jabberFS file request</desc>
</query>
</iq>
2.a ACCEPT GET_PROPOSAL_RESUME (resume broken file)
Mephisto accepts it and offers this file on port 6666.
<iq type="result" to="Faust at goethe.de" id="file_1">
<query xmlns="jabber:iq:oob">
<listening/>
<append/>
<ip>66.66.66.66</ip>
<port>6666</port>
<filename>song_hell.mp3</filename>
<filesize>3050122<filesize>
<filebytesdone>66000</filebytesdone>
<desc>standart jabberFS file request</desc>
</query>
</iq>
if Mephisto has another file with the same name but other size, he
will offer this, too.
Faust can deside to accept this or to send a </block>
<iq type="result" to="Faust at goethe.de" id="file_1">
<query xmlns="jabber:iq:oob">
<listening/>
<ip>66.66.66.66</ip>
<port>6666</port>
<filename>song_hell.mp3</filename>
<filesize>3050743<filesize>
<desc>standart jabberFS file request</desc>
</query>
</iq>
Mephisto is behind a firewall and responds with a connect
indicating that Faust
must create a listening socket.
<iq type="result" to="Faust at goethe.de" id="file_1">
<query xmlns="jabber:iq:oob">
<connecting/>
<append/>
<ip>66.66.66.66</ip>
<filename>song_hell.mp3</filename>
<filesize>3050122<filesize>
<filebytesdone>66000</filebytesdone>
<desc>standart jabberFS file request</desc>
</query>
</iq>
<iq type="set" to="Mephisto at goethe.de" id="file_1">
<query xmlns="jabber:iq:oob">
<listening/>
<append/>
<ip>12.34.56.78</ip>
<port>1234</port>
<filename>song_hell.mp3</filename>
<filesize>3050122<filesize>
<filebytesdone>66000</filebytesdone>
<desc>standart jabberFS file request</desc>
</query>
</iq>
2.b. DECLINE GET_PROPOSAL
Mephisto does not want to offer or does not have this file.
<iq type="result" to="Faust at goethe.de" id="file_1">
<query xmlns="jabber:iq:oob">
<abort/>
</query>
</iq>
More information about the JDev
mailing list