Question: In this assignment you are required to create a Unix domain socket to TCP socket adapter. You should write three programs in this assignment. The

 In this assignment you are required to create a Unix domain

In this assignment you are required to create a Unix domain socket to TCP socket adapter. You should write three programs in this assignment. The first one is the adapter and other two are for demonstration. You must perform error checks at every step. Adapter should receive address file from command line arguments and should accept unix domain connections through this file. Connections should be handled in separate processes. Once a client is connected, adapter should send "address" and the client should send the domain name of the TCP client. Then the adapter should send "port" and client should respond with the port number or designation. Adapter should then use the address and port in domain name resolution and try to connect the requested server over TCP. Once the connection is done, adapter should send "ok" to the client. If there is a problem adapter should send "error". After receiving "ok", client is free to send and receive dala. However, lu keep the program simple, send and receive should be done in order. After sending "ok", adapter should receive data from client, then send it to the server. Then should receive data from the server and send it to client. This should continue until a party closes connection. In that case, adapter should close all connections and exit from the child process. Adapter should be able to handle CTRL+C to exit gracefully. Adapter may sound complicated but most sentences are a single system call. It would be easier if you identify the system calls that you need for each sentence. Second program is the Unix domain client. This program should connect to the adapter and wait to receive "address", once received, it should send the address supplied by user (either through scanf or as argument). The it should wait for another input which should be "port". It should also send the port information and again wait for data. The next data should either be "ok" or "error". If it is error, it should relay this information to the user and quit. If it is ok, it should go into send and receive mode. In this mode the program should ask data from the user and send it to the adapter, and receive data from adapter and display it on screen. This should continue until user presses CTRL+C in which point the program should terminate gracefully. The last program is the TCP server. You are allowed to write any TCP server that will first recy and then send. However, once it starts, it should print out the port number it is listening and should allow graceful exit through CTRL+C. In this assignment you are required to create a Unix domain socket to TCP socket adapter. You should write three programs in this assignment. The first one is the adapter and other two are for demonstration. You must perform error checks at every step. Adapter should receive address file from command line arguments and should accept unix domain connections through this file. Connections should be handled in separate processes. Once a client is connected, adapter should send "address" and the client should send the domain name of the TCP client. Then the adapter should send "port" and client should respond with the port number or designation. Adapter should then use the address and port in domain name resolution and try to connect the requested server over TCP. Once the connection is done, adapter should send "ok" to the client. If there is a problem adapter should send "error". After receiving "ok", client is free to send and receive dala. However, lu keep the program simple, send and receive should be done in order. After sending "ok", adapter should receive data from client, then send it to the server. Then should receive data from the server and send it to client. This should continue until a party closes connection. In that case, adapter should close all connections and exit from the child process. Adapter should be able to handle CTRL+C to exit gracefully. Adapter may sound complicated but most sentences are a single system call. It would be easier if you identify the system calls that you need for each sentence. Second program is the Unix domain client. This program should connect to the adapter and wait to receive "address", once received, it should send the address supplied by user (either through scanf or as argument). The it should wait for another input which should be "port". It should also send the port information and again wait for data. The next data should either be "ok" or "error". If it is error, it should relay this information to the user and quit. If it is ok, it should go into send and receive mode. In this mode the program should ask data from the user and send it to the adapter, and receive data from adapter and display it on screen. This should continue until user presses CTRL+C in which point the program should terminate gracefully. The last program is the TCP server. You are allowed to write any TCP server that will first recy and then send. However, once it starts, it should print out the port number it is listening and should allow graceful exit through CTRL+C

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!