: You are required to implement a server program that responds to both TCP and UDP requests from the corresponding clients. The service provided by the server is simply a substitute cipher/cryptosystem. The cipher replaces one character to another based on some key. The input message (plaintext) can be of any size but composed only of small-letter (abcdefghijklmnopqrstuvwxyz). The output (ciphertext) has the same size and composed also of small-letter characters. The key is limited to 7 characters (also small-letter). You need to treat each digit as a number according to its position in the alphabet. For example, a=0, b=1, …,z=26. To encrypt a message, you add a plaintext character with the corresponding key character (mod 26). The key might be repeated to match the length of the plaintext message. In the decryption, you subtract the corresponding key character from the ciphertext character (mod 26). Again the key might be repeated as necessary. For example, if the key is “nesdept” the process goes as follows: Plaintext: hellostudents Key: nesdeptnesdept Ciphertext: uidoshmhhwqxh In the decryption, the reverse is performed so you get the original massage. The server should wait for requests on the same port for both TCP and UDP requests. T
: You are required to implement a server program that responds to both TCP and UDP requests from the corresponding clients. The service provided by the server is simply a substitute cipher/cryptosystem. The cipher replaces one character to another based on some key. The input message (plaintext) can be of any size but composed only of small-letter (abcdefghijklmnopqrstuvwxyz). The output (ciphertext) has the same size and composed also of small-letter characters. The key is limited to 7 characters (also small-letter). You need to treat each digit as a number according to its position in the alphabet. For example, a=0, b=1, …,z=26. To encrypt a message, you add a plaintext character with the corresponding key character (mod 26). The key might be repeated to match the length of the plaintext message. In the decryption, you subtract the corresponding key character from the ciphertext character (mod 26). Again the key might be repeated as necessary. For example, if the key is “nesdept” the process goes as follows: Plaintext: hellostudents Key: nesdeptnesdept Ciphertext: uidoshmhhwqxh In the decryption, the reverse is performed so you get the original massage. The server should wait for requests on the same port for both TCP and UDP requests. T
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
Description:
You are required to implement a server program that responds to both TCP and UDP requests from the
corresponding clients. The service provided by the server is simply a substitute cipher/cryptosystem. The
cipher replaces one character to another based on some key. The input message (plaintext) can be of any size
but composed only of small-letter (abcdefghijklmnopqrstuvwxyz). The output (ciphertext) has the same size
and composed also of small-letter characters. The key is limited to 7 characters (also small-letter). You need to
treat each digit as a number according to its position in the alphabet. For example, a=0, b=1, …,z=26. To
encrypt a message, you add a plaintext character with the corresponding key character (mod 26). The key
might be repeated to match the length of the plaintext message. In the decryption, you subtract the
corresponding key character from the ciphertext character (mod 26). Again the key might be repeated as
necessary. For example, if the key is “nesdept” the process goes as follows:
Plaintext: hellostudents
Key: nesdeptnesdept
Ciphertext: uidoshmhhwqxh
In the decryption, the reverse is performed so you get the original massage.
The server should wait for requests on the same port for both TCP and UDP requests. The TCP part MUST be
concurrent. However, the UDP part must be iterative. Furthermore, you are requested to use host and service
names in you code, rather that the IP and port numbers. That is, you need to edit some configuration files (see
lecture recordings) and add necessary lines to map between your server local IP address and some hostname,
and also to map between your server port number and some service name. For this assignment, the server
hostname is nes416_crypto_server and the service name is nes416_port.
The client part (TCP or UDP), will display the following menu to the user to select from:
1. Encrypt a message
2. Decrypt a message
3. Exit
4. Listing files in the current directory on the server
If the user selects 1, the encryption must be implemented by the client. The client asks the user to enter a
plaintext message (NULL terminated) and a key. Then it encrypts the message and sends it to the server. The
server, which implements the decryption, reads the encrypted message, asks the user to enter the key, then
sends the plaintext message to the client. Then, the client prints the received message on standard output
together with the IP address and port number of the server.
If the user selects 2, the decryption must be implemented by the client. The client asks the user to enter a
ciphertext message (NULL terminated) and a key. Then it decrypts the message and sends it to the server. The
server, which implements the encryption in this case, reads the decrypted message, asks the user to enter the
key, then sends the corresponding ciphertext message to the client. Then, the client prints the received message
on standard output together with the IP address and port number of the server.The connection between your client and server should stay open, so that the client can repeat the operation
again. You should also add a logout or stop type of a command so that the client can tell the server that it is
finished and the session should end. For example, if the user enters --, the client and server program terminates.
Note that the server displays the IP address and port number of each client request
Output Sample:
For example, running the code should produce something similar to this output:
Client>
Enter a msg: hellostudents
Enter a key= nesdept
Sent Encrypted msg: uidoshmhhwqxh
Received plaintext msg: hellostudents from the server(print the
IP address and port number of the server)
Enter a msg: --
Exiting...thank you
Server> waiting for client’s request
Received ciphertext uidoshmhhwqxh from client:(print the IP
address and port number of the client)
Enter Key: nesdept
Sent hellostudents to the client
Waiting for clients request
Received -- from client:(print the IP address and port number of
the client) Exiting…
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