1. Please use only the C as the language of programming.
2. Please submit/upload on Canvas, the following les for each of your programs: (1) the client and the server source les each (2) the
client and the serve executable les each (3) a brief Readme le that shows the usage of the program.
3. Please appropriately comment your program and name all the identiers suitable, to enable enhanced readability of the code.
Problems
1. Write an ftp client that sends a request for downloading a le to your own ftp server. The server responds
with the contents of the le that is stored on the client local directory. The server checks the size of
the le before responding and if the le size is greater than 1024 bytes, instead of sending the le, the
responds with the message "File size greater than 1 KB" and waits further for another request from the
client. The connection is terminated only when client terminates the same.
2. Now, instead of using ftp, you would use develop a Web server that also responds with the le contents
upon being contacted by the client. Your simple Web server would be capable of processing only one
request. Specically, your Web server will (i) create a connection socket when contacted by a client (a
web browser); (ii) receive the HTTP request from this connection (read the http command sequences,
discussed in class); (iii) parse the request to determine the specic le being requested; (iv) get the
requested le from the servers le system, restricted to local directory; (v) create an HTTP response
message consisting of the requested le preceded by header lines; and (vi) send the response over the
TCP connection to the requesting browser. If a browser requests a le that is not present in your server,
your server should return a 404 Not Found error message. You may use the skeleton code for your server
available on textbook's companion Web site. Your job is to complete the code, run your server, and then
test your server by sending requests from browsers. Use the port no other than 80 if you run your server
on a host that already has a Web server running on it.
3. In this programming assignment, you will write a client ping program. Your client will send a simple
ping message to a server, receive a corresponding pong message back from the server, and determine
the delay between when the client sent the ping message and received the pong message. This delay
is called the Round Trip Time (RTT). The functionality provided by the client and server is similar to
the functionality provided by standard ping program available in modern operating systems. However,
standard ping programs use the Internet Control Message Protocol (ICMP), whereas your client would
be a simple UDP-based ping program.
Your ping program is to send 10 ping messages to the target server over UDP. For each message, your
client is to determine and print the RTT when the corresponding pong message is returned. Because
UDP is an unreliable protocol, a packet sent by the client or server may be lost. For this reason, the
client cannot wait indenitely for a reply to a ping message. You should have the client wait up to one
second for a reply from the server; if no reply is received, the client should assume that the packet was
lost and print a message accordingly. For this assignment, the complete code for the server is available in
the companion Web site of the textbook. Your job is to write the client code, which will be very similar
to the server code. It is recommended that you rst study carefully the server code. You can then write
your client code, liberally cutting and pasting lines from the server code.
Get Answers For Free
Most questions answered within 1 hours.