Assignment 1
Assignment 1
Assignment 1
a dummy time delay at server before sending ACK packet corresponding to a DATA packet
to get the output in the desired format.
Packet Format: You have to use a uniform packet format for data packets and ACK
packets. Typical fields in a packet structure can be are; pkt_type, pkt_length, is_last_pkt,
payload, pkt seq_no . (Note: you can add more fields based on your implementation.)
The client program should take the server IP address, Server port number, file_name,
pkt_size, and WS as command line arguments. The client and server should display the
output in the format shown in Fig. 2. The client and server must be able to run on
different hosts as well as on the same host.
Implementation Guidelines:
i) Handle errors/exceptions and program termination in a graceful manner.
ii) Put comments in your code at appropriate places for better readability.
iii) Create a readme file (readme.txt) which contains key implementation details
(e.g., packet format, packetization process, file writing process etc.) and
limitations of your implementation.
Fig.1
Page |3
Client Server
----SEND PACKET 0 ---- RECEIVE PACKET 0 length 500 LAST PKT N
----SEND PACKET 1 ---- SEND ACK 0
----SEND PACKET 2 ---- RECEIVE PACKET 1 length 500 LAST PKT N
----RECEIVE ACK 0 ---- SEND ACK 1
----RECEIVE ACK 1 ---- RECEIVE PACKET 2 length 500 LAST PKT N
----RECEIVE ACK 2 ---- SEND ACK 2
----SEND PACKET 3 ---- RECEIVE PACKET 3 length 500 LAST PKT N
----SEND PACKET 4 ---- SEND ACK 3
----SEND PACKET 5 ---- RECEIVE PACKET 4 length 500 LAST PKT N
----RECEIVE ACK 3 ---- SEND ACK 4
----RECEIVE ACK 4 ---- RECEIVE PACKET 5 length 500 LAST PKT N
----RECEIVE ACK 5 ---- SEND ACK 5
----SEND PACKET 6 ---- RECEIVE PACKET 6 length 500 LAST PKT N
----SEND PACKET 7 ---- SEND ACK 6
----SEND PACKET 8 ---- RECEIVE PACKET 7 length 500 LAST PKT N
----RECEIVE ACK 6 ---- SEND ACK 7
----RECEIVE ACK 7 ---- RECEIVE PACKET 8 length 300 LAST PKT Y
----RECEIVE ACK 8 ---- SEND ACK 8
----CLOSING CONNECTION ---- CLOSING CONNECTION
Fig.2
---x---x---x---