-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
45 lines (34 loc) · 1.93 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Before running sendfile and recvfile, ensure that sendfile.jar and recvfile.jar are
in the same directory. The source files are located in src/filetransfer.
The syntax for running both programs are as follows:
./sendfile -r <recv_host>:<recv_port> -f <filename>
./recvfile -p <recv_port>
PACKET STRUCTURE
================
All of the packets from the sender to the receiver use the following format:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Sequence Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Checksum | Data Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|F|L| Flags | |
+-+-+-+-+-+-+-+-++ |
| Data |
| |
| |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* The sequence number identifies what section of the file is contained
in the packet.
* The checksum is used to verify the integrity of the packet.
* The data length is used to validate the length of the data section.
* The flags are used to indicate the first and last packet of the transfer.
* The rest is data.
To initiate the transfer, a packet is sent from the sender with the
name of the file and the listening port to return ACKs to.
All packets after that contain chunks of the file, identified by the
sequence number.
To signify the end of a transfer, an empty packet is set with the Last Packet
flag set in the header.