Objectives: To implement a client and a server application using UDP and TCP soc

Need help with assignments?

Our qualified writers can create original, plagiarism-free papers in any format you choose (APA, MLA, Harvard, Chicago, etc.)

Order from us for quality, customized work in due time of your choice.

Click Here To Order Now

Objectives:
To implement a client and a server application using UDP and TCP soc

Objectives:
To implement a client and a server application using UDP and TCP sockets;
To use C/C library functions for implementing socket applications;
To get familiarized with the Unix programming environment.
Introduction:
For this project, you will be writing programs that will implement Chit, a secure chat application between two users using TCP socket streams. A Chit chat communication will be implemented using end-to-end encryption on messages exchanged between users.
You may use the Public Key (PK) Server program from Project 1 to manage the users’ public keys.
You will be writing an Address Server program to manage the “listening” addresses of the client processes being used by individual users who are currently logged in. Chit chat clients should look up another user’s “listening” address to enable a direct chat with that other user. All user-to-user communication should be through a TCP socket and all communication between a client and the servers will be through UDP sockets. All Chit chats between users should be encrypted using RSA public key encryption (PKE).
The components to this programming project are:
A. Chit Chat Client:
Provides a user interface that implements secure communication with other Chit users through TCP sockets.
Performs chat message encryption and decryption using RSA PKE.
B. Public Key Server:
Manages users’ public-key.
Communicates with Chit clients through UDP sockets.
C. Address Server:
Maintains the listening addresses of Chit users who are currently logged-in.
Communicates with Chit clients through UDP sockets.
Description:
Secure communication requires a Chit client to encrypt a message using the recipient user’s public key. Therefore, a user must register their public key with the Public Key server before sending a login message to the Address server.
In order to allow any two client processes to communicate with each other, the initiating client must have the “listening” TCP port number (and IP address) that the other client is using for receiving messages.
During login, the client process should send a message to the Address server containing the user’s userid and the TCP port number it will be listening on. The Address server should store this information for each logged in user. A user could then determine who are currently logged in by having the client process send a who query to the Address server. The server should then respond with the corresponding list of userids from users who have sent a login message. A user then has the option to initiate a Chit chat session with another user or wait for a request to chat from another user. A chat request should be performed by first sending an “address lookup” message for a particular userid to the server. The server then responds with the corresponding address information (IP address and TCP port number), which the initiating client could then use to setup a direct TCP connection with the other client. The receiving user should be given the option to accept or decline the request to chat. If the chat request was accepted, the two users should be able to chat directly by sending their messages over a TCP connection.
Before messages can be exchanged, each user must send a request for the recipient user’s key from the Public Key server. All messages should be encrypted before transmission during a chat session.
You only need to implement a one-to-one chat session for this programming project, i.e., the user need not be able to receive another chat request while participating in a “chat” session. Either user can terminate the chat session by sending an end-of-file character or CTRL-D. Each client should be able to send or receive another chat request after each session without terminating the process. Each client should also send a logout message to the server before exiting to allow the server to clear any entries corresponding to the user. Messages between client and server should be implemented using only UDP sockets.
You are expected to design the structure of the messages exchanged between a client and the server and messages between clients.
Procedure:
A. Chit Chat Client
The Chit chat client process should perform the following activities:
Register keyA client should register a public key to the Public Key server once with the corresponding user’s ID.
Wait to receive an acknowledgement message to confirm registration was
Login messageA client should automatically send a login message to the server at startup to allow the Address server to store user’s ID, “listening” TCP port, and IP
An acknowledgement message should be received from the server to confirm login information.
Who queryThe user should be able to send a who query to the server, between chat sessions, for the list of users who are currently logged in.
The received list should then be displayed for the user.
Initiate a Chit chat sessionThe user should be able to initiate a chat session with another user who is currently logged in.
This should be accomplished by the client process first sending an address lookup request to the server, and using the received information to initiate a chat request directly with the other user.
Receive Chit chat requests The user should be able to receive chat requests from other Chit users.
The user need not be able to receive chat requests while engaged in a chat session.
Request public keyThe user should be able to send a request for public to the Public Key server, at the beginning of a chat.
Exchange secure Chit chat messagesSend encrypted messages using recipient’s public key
Decrypted received messages using own private key
Accept/Decline Chit chat requestsOnce a TCP connection has been established, the receiving user should be given the option to accept or decline the request before any messages are received. The TCP connection should be terminated when a request to chat is declined.
Send logout message to the serverBefore a client exits, it should automatically send a logout message to the server to allow the server to clear any entries corresponding to the user.
Quit The user should be able to quit at any time using a quit command (not Ctrl-C).
B. Public Key Server
The Public Key server process performs the following activities. The server should maintain a table of public keys that have been registered and a table to store all messages.
Process key registrationReceive register key messages from Chit clients
Store the received for each registered user
Process key requestsReceive request public key messages from Chit clients
Respond with the requested in the response public key message
C. Address Server
The Address server process performs the following activities:
Receive login messages from clientsThe server should maintain a table of TCP addresses for all users who are currently logged-in.
Receive who queries from clientsThe server should be able to receive who queries from clients and process each accordingly.
Send login list to clientsWhen the server receives a who query from a client, the server should immediately respond with a message containing the list of users who are currently logged in.
Receive logout messages from clientsThe server should clear the entry in its table of addresses for every client who logs out and send an acknowledgement.
Each running process should display messages describing pertinent activities as they occur (i.e, display a message describing what message has been sent or received whenever each happens). This is particularly important and useful in verifying the correctness of your programs.
Lastly, the Chit client, Public Key server, and Address server processes should behave sensibly when dealing with exceptional conditions.
For Graduate Credit: To obtain graduate credit for this project, your programs should have the following additional functionalities:
Address Server: Upon receiving a login message, the server should also send to the client process the list of userids of currently logged in users as part of its acknowledgement message. In addition, for each login message received, the server should also send a notification to all other currently logged in users the userid of newly logged in user.
Chat Client: The client process should be able to receive the list of userids sent by the server for display to the user. All clients should also be able to receive notification messages from the server at any time (while idle or while actively participating in a chat session).
Implementation:
Two separate processes will be needed to enable a client to perform the various activities needed to communicate with the server, another client, and interact with the user. To enable a client to do this, the parent process should be given the responsibility of interacting with the user and communicating with the server while a child process must be fork()ed to handle the receiving of messages from another client. (Note to graduate students: You’ll need another child process to receive the notifications from the server.)
Below are sample code to demonstrate the use of the fork()function.
/* Sample1: This program illustrates the use of the fork() function. Note how the two processes do not share the contents of memory variable ptr.*/
#include
#include
void main ()
{
int x;
int * ptr;
ptr = &x;
if (fork() == 0){
for (x=1; x < 5; x ){ printf("child: %dn", (*ptr) ); } exit(0); } for (x=1; x < 5; x ){ printf("parent: %dn", (*ptr) ); } } /* Sample2: This program illustrates the use of the fork() function. Note how the two processes share the contents of memory variable ptr using the mmap() function.*/ #include
#include
void main ()
{
int x;
int * ptr;
ptr=mmap(NULL,sizeof(int),PROT_READ|PROT_WRITE,MAP_SHARED|MAP_ANON,-1,0);
if (fork() == 0){
for (x=1; x < 5; x ){ printf("child: %dn", (*ptr) ); sleep(1); } exit(0); } for (x=1; x < 5; x ){ printf("parent: %dn", (*ptr) ); sleep(1); } } Submission Requirements: You may work with a partner for this activity. You are allowed to modify the given echo client/server programs. (Review the course policy on Academic Dishonesty.) All code should be written in GNU C or C++ Make sure you provide sufficient documentation in the form of comments, white space, readable identifiers, and a README text file describing the system operation (i.e., how to compile and run each program) and its components. Store all source code and the README file in a folder called your_last_name(s) Project2. Use zip to compress the entire folder and upload your file using the designated project submission Grading Criteria: Documentation 10% ImplementationCorrectness 65% User interface 25%

Need help with assignments?

Our qualified writers can create original, plagiarism-free papers in any format you choose (APA, MLA, Harvard, Chicago, etc.)

Order from us for quality, customized work in due time of your choice.

Click Here To Order Now