The reply messages from the server to the client should follow this format Туре (one bytes) result (variable length) The reply type is a one-byte value that represents the status of the reply. Success (0) or error (1). If success, the result field contains the answer of the requested operation. Otherwise, it contains an error message indicating the error that occurred. For example, the client might ask for a character that doesn't exist in the string. Remember that the (child) server should prints the IP and port number from which it receives the request The IP address and port numbers of the server should be passed as command-line arguments to the client. And the port number on which the server waits should be passed also as command-line argument to the server. i.e to run the client you enter (assuming your client is named hw1_client): $hw1 client And to run the server you enter (assuming your server is named hw1_server): Sample: $hw1_server Output For example, running the code should produce something similar to this output: Client side> please enter a string: hello students (input from a user) Client side > please select an operation from the following menu (menu is displayed for the user...) Client side> sending "hello students" to the server with requested operation 1 Client side > received "HELLO STUDENTS" from the server (if an error occurred, then it is displayed) Client side > please select an operation from the following menu ( menu is displayed for the user...) And the same happens again until the user quits by generating the SIGQUIT. At the time it prints goodbye Server_side > waiting for client messages. Sever_side > reveiced "hello students" from the client (IP address, port #) with request No. 1 Server_side > Sending "HELLO STUDENTS" to the client Server_side > waiting for client messages Server_side > received exit from client...Goodbye (assuming the client exited) Parent_server> child whose ID = .... Has exited (state the PID of the child) Goal: Understand how to build a concurrent server and deal with signals Description: Use TCP socket programming in C to implement a pair of client and server programs. The client simply asks the user to enter a string (null-terminated), and then displays a menu for the user to select an operation on that string. The string and the type of operation are sent to the child server which performs the required operation and returns the result back to the client. That is, the server (parent) creates a child for each request of the client (you need to print the port and IP address of the client on the server terminal). Then it waits for the child to finish processing client's request and prints the process ID of the terminated child. The connection between your client and server should stay open, so that the client can send another request. However, the exit will happen when the user sends the client program the SIGQUIT signal. The handler will print a notifying message (for example, "Good bye") before the client exits. Note that in all cases, the parent server is kept running. The connection between your client and (child) server should stay open so that another request can be sent (re-display the menu) or until the user sends (generates) the SIGQUIT signal, at which time the client's handler will print a notifying message on the clients terminal (good bye) before it (the client) exits. The menu displayed to the user (client side) is composed of the following choices: 1. Change the string to capital letters 2. Count number of characters in the string 3. Count the frequency of some character (the user has to enter a character) 4. Enter another string The server once receives the string, performs the required operation and returns the result back to the client waiting for another request. The string should be at most 80 characters The request messages from the client and the server should follow this format Request type (one bytes) Args (one byte) String (variable length) The request is a one-byte representing the operation that is required. Its value depends on the choices of the menu. For example, if the client wants to count the characters in the string, the request value will be 2, and so on. The Args is a one-byte representing the arguments of some of the requests. For example, if the clients asks for the frequency of occurrence of the letter b in the string, the request value will be 3 and the Args is the desired character. If the request requires no argument this field is unused. The string field contains the actual sent string.
The reply messages from the server to the client should follow this format Туре (one bytes) result (variable length) The reply type is a one-byte value that represents the status of the reply. Success (0) or error (1). If success, the result field contains the answer of the requested operation. Otherwise, it contains an error message indicating the error that occurred. For example, the client might ask for a character that doesn't exist in the string. Remember that the (child) server should prints the IP and port number from which it receives the request The IP address and port numbers of the server should be passed as command-line arguments to the client. And the port number on which the server waits should be passed also as command-line argument to the server. i.e to run the client you enter (assuming your client is named hw1_client): $hw1 client And to run the server you enter (assuming your server is named hw1_server): Sample: $hw1_server Output For example, running the code should produce something similar to this output: Client side> please enter a string: hello students (input from a user) Client side > please select an operation from the following menu (menu is displayed for the user...) Client side> sending "hello students" to the server with requested operation 1 Client side > received "HELLO STUDENTS" from the server (if an error occurred, then it is displayed) Client side > please select an operation from the following menu ( menu is displayed for the user...) And the same happens again until the user quits by generating the SIGQUIT. At the time it prints goodbye Server_side > waiting for client messages. Sever_side > reveiced "hello students" from the client (IP address, port #) with request No. 1 Server_side > Sending "HELLO STUDENTS" to the client Server_side > waiting for client messages Server_side > received exit from client...Goodbye (assuming the client exited) Parent_server> child whose ID = .... Has exited (state the PID of the child) Goal: Understand how to build a concurrent server and deal with signals Description: Use TCP socket programming in C to implement a pair of client and server programs. The client simply asks the user to enter a string (null-terminated), and then displays a menu for the user to select an operation on that string. The string and the type of operation are sent to the child server which performs the required operation and returns the result back to the client. That is, the server (parent) creates a child for each request of the client (you need to print the port and IP address of the client on the server terminal). Then it waits for the child to finish processing client's request and prints the process ID of the terminated child. The connection between your client and server should stay open, so that the client can send another request. However, the exit will happen when the user sends the client program the SIGQUIT signal. The handler will print a notifying message (for example, "Good bye") before the client exits. Note that in all cases, the parent server is kept running. The connection between your client and (child) server should stay open so that another request can be sent (re-display the menu) or until the user sends (generates) the SIGQUIT signal, at which time the client's handler will print a notifying message on the clients terminal (good bye) before it (the client) exits. The menu displayed to the user (client side) is composed of the following choices: 1. Change the string to capital letters 2. Count number of characters in the string 3. Count the frequency of some character (the user has to enter a character) 4. Enter another string The server once receives the string, performs the required operation and returns the result back to the client waiting for another request. The string should be at most 80 characters The request messages from the client and the server should follow this format Request type (one bytes) Args (one byte) String (variable length) The request is a one-byte representing the operation that is required. Its value depends on the choices of the menu. For example, if the client wants to count the characters in the string, the request value will be 2, and so on. The Args is a one-byte representing the arguments of some of the requests. For example, if the clients asks for the frequency of occurrence of the letter b in the string, the request value will be 3 and the Args is the desired character. If the request requires no argument this field is unused. The string field contains the actual sent string.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question

Transcribed Image Text:The reply messages from the server to the client should follow this format
Туре
(one bytes)
result
(variable length)
The reply type is a one-byte value that represents the status of the reply. Success (0) or error (1).
If success, the result field contains the answer of the requested operation. Otherwise, it contains an error
message indicating the error that occurred. For example, the client might ask for a character that doesn't
exist in the string. Remember that the (child) server should prints the IP and port number from which it
receives the request
The IP address and port numbers of the server should be passed as command-line arguments to the
client. And the port number on which the server waits should be passed also as command-line argument
to the server. i.e to run the client you enter (assuming your client is named hw1_client):
$hw1 client <ip address of the server> <port of the server>
And to run the server you enter (assuming your server is named hw1_server):
Sample:
$hw1_server <port of the server> Output
For example, running the code should produce something similar to this output:
Client side> please enter a string:
hello students (input from a user)
Client side > please select an operation from the following menu (menu is displayed for the user...)
Client side> sending "hello students" to the server with requested operation 1
Client side > received "HELLO STUDENTS" from the server (if an error occurred, then it is
displayed)
Client side > please select an operation from the following menu ( menu is displayed for the user...)
And the same happens again until the user quits by generating the SIGQUIT. At the time it
prints goodbye
Server_side > waiting for client messages.
Sever_side > reveiced "hello students" from the client (IP address, port #) with request No. 1
Server_side > Sending "HELLO STUDENTS" to the client
Server_side > waiting for client messages
Server_side > received exit from client...Goodbye (assuming the client exited) Parent_server>
child whose ID = .... Has exited (state the PID of the child)

Transcribed Image Text:Goal: Understand how to build a concurrent server and deal with signals Description:
Use TCP socket programming in C to implement a pair of client and server programs. The
client simply asks the user to enter a string (null-terminated), and then displays a menu for the user to
select an operation on that string. The string and the type of operation are sent to the child server which
performs the required operation and returns the result back to the client. That is, the server (parent)
creates a child for each request of the client (you need to print the port and IP address of the client on
the server terminal). Then it waits for the child to finish processing client's request and prints the
process ID of the terminated child.
The connection between your client and server should stay open, so that the client can send another
request. However, the exit will happen when the user sends the client program the SIGQUIT signal.
The handler will print a notifying message (for example, "Good bye") before the client exits. Note that
in all cases, the parent server is kept running.
The connection between your client and (child) server should stay open so that another request can be
sent (re-display the menu) or until the user sends (generates) the SIGQUIT signal, at which time the
client's handler will print a notifying message on the clients terminal (good bye) before it (the client)
exits.
The menu displayed to the user (client side) is composed of the following choices:
1. Change the string to capital letters
2. Count number of characters in the string
3. Count the frequency of some character (the user has to enter a character)
4. Enter another string
The server once receives the string, performs the required operation and returns the result back
to the client waiting for another request. The string should be at most 80 characters
The request messages from the client and the server should follow this format
Request type
(one bytes)
Args
(one byte)
String
(variable length)
The request is a one-byte representing the operation that is required. Its value depends on the
choices of the menu. For example, if the client wants to count the characters in the string, the request
value will be 2, and so on. The Args is a one-byte representing the arguments of some of the requests.
For example, if the clients asks for the frequency of occurrence of the letter b in the string, the request
value will be 3 and the Args is the desired character. If the request requires no argument this field is
unused. The string field contains the actual sent string.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY