Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Build a simple File Transfer Service that consists of a client and server. The server exports a set of files from the computer on which

Build a simple File Transfer Service that consists of a client and server. The server exports a set of files from the computer on which it runs to be downloaded on the client computer. That is: a client requests a file from the server and the server responds to the client by sending the file. Client will request one file at a time. Server will send the contents of the file followed by the end-of-transmission packet and then exits. Client must save the file on the local computer with the same file name. Server records all file download activities in a log file. You should build your MFTP on UDP ports. Use sequence number on data blocks to enforce reliability. The message from the client and the response from the server are transmitted as the content of UDP datagrams.

Each message is identified by a packet type as follows:

Packet type| Explanation

0 | ACK packet(i.e., acknowledgement packet).

1 | Request a file to be read from the server i.e., this packet carries file name to be downloaded.

2 | Data packet, i.e, contains data being transferred

3 | Reports an error [error message: File not found]

4 | EOT packet, i.e., it is an end-of-transmission (EOT) packet

Format of the UDP packet being transmitted between the client and the server is:

Type of the packet

Sequence number

Length (data size)

Data (<= 16 bytes), depending on the packet type.

The EOT packet is in the same format as a regular data packet, except that its type field is set to 4 and its length is set to zero. The server can close its connection and exit only after it has received ACKs for all data packets it has sent. The length field specifies the number of characters carried in the data field. It should be in the range of 0 to 15. For ACK packets, length should be set to zero.

Implementation:

Both client and server will run from the command line as follows: >client >server The is the name of the file to be downloaded from the server. The RN is used by the server to emulate lost packets as,

If RN = 0 all packets are received by the receiver,

If RN = 1 first packet of the current winodw is lost,

If RN = 2 all packets of the current window are lost.

Output: In order to observe the performance of the sliding window protocol and to check whether your implementation is working properly, you need to collect statistics. You should collect statistics for both the client and server. After transferring a file you should print out the following suggested statistics (you should add your own which are appropriate to your specific project):

1. the total number of data packets transmitted

2. the total number of retransmissions

3. the total number of acknowledgments sent

4. the total number of acknowledgments received

5. the total number of duplicate packets received

6. the total amount of data sent.

7. A log file of actions, recording all activities between the client and server.

A packet class: public class Packet { /* Packet Constructor: * t = type * i = seqno * j = size of the packet */ public Packet(int t, int i, int j, byte abyte[]) { type = t; seqno = i; size = j; data = new byte[size]; data = abyte; } public byte[] getData() { return data; } public int getSeqNo() { return seqno; } public int getSize() { return size; } public boolean getType() { return type; } public String toString() { return "type: " + type + "seq: " + seqno + " size: " + size + " data: " + data; } private int type; private int seqno; private int size; private byte data[]; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL/PHP Database Applications

Authors: Jay Greenspan, Brad Bulger

1st Edition

978-0764535376

More Books

Students also viewed these Databases questions

Question

What is the purpose of a code of conduct?

Answered: 1 week ago

Question

=+j Describe the various support services delivered by IHR.

Answered: 1 week ago