Sale!

Network Programming (ECE-C433) Programming Assignment 4 (HW4) solution

$30.00 $25.50

Category:

Description

5/5 - (3 votes)

Problem 1. Basic Clients-Server Program: Download the client and server programs for incrementing
called incrementClient.c and incrementServer.c provided online. The programs work as explained in class (the
server increments the number sent by the client and sends it back to the client).

a. The code as written works with only a specific server side port (10001). Modify the code so that the server
port may be specified as a command line argument to both the server and client programs. What do you think
is the range of TCP port numbers for which the server program works? Use trial and error to determine this answer.
b. Modify the programs to print out the client’s TCP port number assigned by the client host (it is okay if it
is the server that prints it out). What do you think is the range of TCP port numbers assigned to the client (as
before, you can make a reasonable guess by running the client multiple times)?

c. The code does not work efficiently since the numbers are transmitted as strings instead of as binary numbers.
Using binary numbers will require fewer bytes to be transmitted between client and server. Modify the programs
to accomplish this.
1 (ECE-C433) Programming Assignment 4

Problem 2. Synchronized Repository Folder: In this problem, you will create a Dropbox-like application
for synchronizing files in a folder across several computers (or several folders on the same computer). A user
should be able to ¨link¨several folders via a server such that the content in all those folders are identical.

In each
folder, a user will need to manually issue a link command and provide the server name. The user will then issue
a synchronize command to propogate changes and files to the server, which will then be reflected in other folders
after a synchronize.
The client side should do the following:

Provide the user with a commandline with the following options:
• (l) Link
• (u) Unlink
• (s) Synchronize
• (i) Information

Option descriptions:

• (l) Link: If the current directory is not linked, the user can issue the (l) command to link their current
directory with the remote server. The user will be prompted for the server’s IP.
• (u) Unlink: This can be issued to unlink the current directory with the remote server
• (s) Synchronize: This will synchronize the files within the current linked directory with those on the server.
Deleting files from the linked client folder should also delete from the server and other client folders linked
to the server when a synchronize has been issued from those folders.

• (i) Information: This should output the state of the current folder, showing if the folder is linked and to
which server.
Command allowance:
• When a client directory is not linked, only the (l) and (i) options should be available
• When a client directory is linked, only the (u), (s) and (i) option should be available
The server should do the following:
• It must work with the client to determine which files to push to the client and which ones to download from
the client

• It must be able to handle files deleted from the client
• You must be able to handle more than one connection at the same time. The server can assume that race
situations will not occur (ie a requested file being transferred is deleted by one linked folder before it has a
chance to send it but after it has already promised it to another folder).

Notes:
• You will most likely need to store information about individual files in a flat file on both the client and the
server
(ECE-C433) Programming Assignment 4