Question: This is a problem related to socket programing. Soluton can either be in java or Python. Implement an iterative UDP based client-server architecture, in which

This is a problem related to socket programing. Soluton can either be in java or Python. Implement an iterative UDP based client-server architecture, in which the server can queue at least five requests. Assume that UDP checksum provides a sufficient level of reliability.

Hint(details)

Details A client takes five arguments: the name of the server machine, the port number to which it should connect, the execution_count, the time_delay (in seconds) and the command (in that order). It translates the server name to its IP address using the gethostbyname() system call, uses the IP address to fill in a sockaddr_in structure, and then opens a socket to the server using the socket and connect system calls. Next, the client sends the command as an ASCII string, using the write system call. Finally, it reads the reply, using the read call, and displays the result on the screen using the write system call. The server takes one argument, which is the port number on which it listens for an incoming command. It fills in a sockaddr_in structure with the port number, with the incoming address field (s_addr) set to INADDR_ANY. The server should display its IP Address / servername for the client to connect to it. The server uses the socket, bind, and listen system calls to create a socket, bind the port number to it, and to listen for a request. On getting the request, server queues it and then accepts it. It reads the message sent to it, executes the corresponding command using the Unix system call and writes the result to a temporary file. It then opens the file for reading, reads the result, and uses the write call to write the results back to the client. TCP/IP does not provide message boundaries. So, the client does not know how long a result to read from the server. To get around this, the first 10 bytes of the server's message is the length of the reply, in ASCII. For example, if the length of the reply is 15 bytes, the first 10 bytes would be ASCII 5, ASCII 1 and eight 0s (use sprintf call to convert from binary to ASCII).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!