Computer Science > QUESTIONS & ANSWERS > University of Windsor COMP 8567 Make two C programs a client and a server to implement a remote.. (All)
Question Answered step-by-step Asked by ChefCrow13252 Make two C programs a client and a server to implement a remote shell connection using sockets. Server: • Two copies of the serve ... r (serverA and serverB) must start running before any of the client/s and wait for connections. Please Note: serverA and serverB are identical copies of the same program running on different terminals/machines When either of the servers receives a request from a client, it forks and lets the child process (of the server) take care of the client's request in a separate function called ServiceClient(), while the parent process goes back to wait for the next client. A server can receive requests from multiple client programs (running on different systems/ different shell terminals of the same system). Each request must lead to a new child process (of the server) that is created to service the request. The Server's Child Process: 1. uses " dup2()" to read from the client socket instead of standard input 2. gets in an infinite loop: - reads a shell command from the client's socket, - if the client sends "quit", then the server's child, closes the socket and quits. - otherwise, it executes the command (You must execute the command without using any of the exec series of system calls) 3. The results of the command must be transferred to the client. Client: The client process connects to the server and gets into an infinite loop 1. reads a command from keyboard, 2. writes the command to the server, 3. if command is "quit", closes the socket, and quits 4. otherwise, reads command output from the socket (received from the server) and displays it on the screen Rules for serverA and serverB (very important) The first 5 client connections are to be handled by serverA The next 5 client connections are to be handled by serverB The remaining client connections are to be handled by serverA and serverB in an alternating fashion. (ex: connection 11 is to be handled by server A, connection 12 by serverB, 13 by serverA and so on) to simulate load balancing. [Show More]
Last updated: 3 years ago
Preview 1 out of 5 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Dec 12, 2022
Number of pages
5
Written in
All
This document has been written for:
Uploaded
Dec 12, 2022
Downloads
0
Views
80
Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·