Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Goal: (write code )investigate TCP/UDP socket programming using I/O multiplexing Description: Use socket programming in C to implement a client that sends/receives request using both

Goal: (write code )investigate TCP/UDP socket programming using I/O multiplexing Description: Use socket programming in C to implement a client that sends/receives request using both UDP and TCP. Similar to assignment # 4, you are requested to build a client that asks for the servers directory content, and download one of these files locally using iterative UDP. In addition, you need to be able to upload a file from the client to the server using concurrent TCP. Details: Once you start your client, you should display a menu from which a command is chosen **********welcome to NES 416 HW #5 ***************** 1- Download a file using UDP 2- Upload a file using TCP 3- Quit *************************************************** If the user selected 1, the same procedure as in assignment 4 is followed. If the user selected 2, he/she is asked to enter a filename that should exist locally to be transferred/uploaded to the concurrent TCP server using a TCP connection and added to the server at its current working directory. Once the upload completes, the corresponding child at the server child terminates and the parent waits for more requests. If the user enters 3, both the client and the servers are terminated. Note that the menu is kept displayed after each operation until 3 is inserted. You need to build two servers for testing: one that works with UDP (the same one as assignment #4) and one with TCP. Both should use the same port for receiving requests. The port number should be specified at command line when starting the servers Your client should take hostname and port number as command arguments. i.e. you need to use server name in your code rather that its IP address. That is, you need to edit the /etc/hosts file in your machine and add a line that specifies the server name as nes416_server and assign it the IP address of your machine. In your code you should use the appropriate functions to convert between hostnames and IP addresses In order not to over flow the receivers buffer with requests, your UDP client cant call the server more than onec per five seconds. Note that your client can accept/receive input from multiple sources, so you need to use I/O multiplexing for enhanced performance Submission: You files should follow the following naming convention: your_group#_HW#, and contains your IDs as comments at the beginning of the code Submit a zipped file containing only the course code (following the naming convention) and a screen shot of compiling and running your code ( both client and server) Hints/Notes: DO NOT use the header file unp.h from the book Your program for client needs to take two arguments that specify the servers hostname and the port that it is trying to connect to. Your program for server needs to take an argument that specifies the port that it is listening to ( the same one provided to the client) Feel free to use any port in this assignment ( ofcourse, above 1024) Some library functions that you might need: getcwd(), opendir(), readdir(), scandir() Ask questions as early as possible. Your programs should be compiled and run without any single error or warning. Comment and error-check you cod

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions