Program_Protocol - PysKa-Ratzinger/rcomp1617pluto GitHub Wiki
Program Protocol
This page will describe in all detail the full program protocol to be used by the application.
Broadcasting
The software, after having asked the user what folder he would like to share over the network will broadcast every 30 seconds a UDP packet that follow the following BNF grammar:
The following is VERSION 3 of the UDP packet protocol
packet: header dict
header: "PLUTO_" version "tport:" port ";nick:" nick ';'
version: 'v' number ';'
port: number
nick: <up to 15 CHARs all of them different from ';' and '\0'>
dict: 'd' entry_list 'e'
entry_list: | entry entry_list
entry: number ':' <number long sequence of any CHAR>
number: [1-9] end_number
end_number: | [0-9]+
File Transfer
File transfering between peers shall work in the following way.
Peer A is the one that has the file.
Peer B is the one that wants the file.
Peer B starts a tcp connection with Peer A and sends a request
Peer A processes the request and sends peer B the content of the whole file
Peer B receives the file's contents
Peer A closes the connection to indicate and end-of-file
Peer B saves the file and closes the connection
Grammar to use in TCP requests
file_name: number ':' <number long sequence of any CHAR>
number: [1-9] end_number
end_number: | [0-9]+