[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[JDEV] Sending files through server...
I have ideas about sending files through server.....
1) Request : User jenny wants to send file named "filename.ext" sized 10 Kbytes (10240 bytes)
<message>
<from>jenny</from>
<say>Hey, I'm sending you this file</say>
<thread>srgh5we3d</thread>
<ext>
<filesend type="fast|replied" name="filename.ext">
<packet>request</packet>
<size>10240</size>
</filesend>
</ext>
</message>
#thread should be a mixed form of unix time (only seconds), file name, and size, so that it wouldn't be the same as other file sends etc.
# In EXT:
# type can be "fast" or "replied".
# In "replied" form, sender waits acknowledgement after each packet sent
# In "fast" form, sender sends each packet without waiting for acknowledgement
# packet can be "request", "end", "cancel" or a number showing the number of the packet
#
# size is the file's size in bytes
2) Re: Request : User alican accepts file
<message>
<from>alican</from>
<thread>srgh5we3d</thread>
<ext>
<filesend name="filename.exe">
<packet>request</packet>
<accept>true|false</accept>
</filesend>
</ext>
</message>
# thread is the same as the above
#
# In EXT:
# accept can be "true" or "false"...
# part is still "request"
# filename is sent back for avoiding problems (there can still be the same thread)
3) Send: User jenny begins sending
<message>
<from>jenny</from>
<say>Sending file: filename.ext</say>
<thread>srgh5we3d</thread>
<ext>
<filesend name="filename.ext">
<packet>1</packet>
<data>File data here...</data>
</filesend>
</ext>
# thread is the same...
#
# In EXT:
# packet: the number of the packet being sent. In every packet, this will be increased...
# name: Am I too afraid of thread problems?
# Filedata: The data in the packet
4) Acknowledgement : User alican acknowledges the packet. Only in "replied" form...
<message>
<from>alican</from>
<thread>srgh5we3d</thread>
<ext>
<filesend name="filename.ext">
<packet>1</packet>
<recevied>Number_Of_Bytes</received>
</filesend>
</ext>
</message>
# I won't say "thread is the same"
#
# In EXT:
# packet: The packet number that receiver acknowledges
# name: OK, I'm too afraid of thread problems...
#
# Number_Of_Bytes: Number of bytes received in the packet. Must be an unsigned-integer. If it isn't equal with sent
# bytes or if it's non-unsigned-integer, packet would simply re-sent
5) End of filesend: User jenny says, it finished sending....
<message>
<from>jenny</from>
<thread>srgh5we3d</thread>
<ext>
<filesend name="filename.ext">
<packet>end</packet>
<size>10240</size>
</filesend>
</ext>
</message>
# packet would be "end" showing file is complete...
# size and filename are sent again. If the receiver thinks he/she's getting abc.txt, but
# in the last packet, he/she sees that it's another file, he/she simply kills the sender ;)
6) Cancel sending/receiving : If one of the clients cancel sending/receiving then should send this message:
<message>
<from>jenny|alican</from>
<thread>srgh5we3d</thread>
<ext>
<filesend name="filename.ext">
<packet>cancel</packet>
</filesend>
</ext>
</message>
----------------------------------------------------------------------------------------------------------------
NOTES:
- Sender will decide packet size. It desn't have to be the same in each packet.
- If a packet acknowledgement is wrong (the recipient recieved wrong num of bytes),
simply the packet would be resent...
- Sender can send packets randomly: like 1-4-2-3... But the problem is how the
recipient would solve the puzzle? ;) Ok, Ok, just a joke, sender should send packets in
order. I don't wanna get mad in front of "ncedit.exe" (tm).
- If a packet number is received twice then the recipient should replace the old packet with
the new one...
- In "replied" form, the sender shouldn't send new packet until it gets acknowledgement.
- In replied form, recipient SHOULDN'T append last packet to the file until sender sends
another packet. Because if the packet is wrong received, sender would resend it...
--------------
QUESTIONS:
1) Who are Jenny and Alican?