Saint Cloud State University Server and Client Worksheet
Description
Purpose:
——–
To learn how to utilize TCP client/server programming. In this case you will be required
to implement a concurrent server that accepts connection from multiple clients.
Requirements:
————-
Using your favorite programming language, implement a client/server simple email application.
In this application you will be running the server continuously, which means the server will
continue to run until you decide to stop it, or kill the process.
You will implement a client program that is capable of connecting to the server, and able to
send/receive emails. All the client is going to be able to do is provide input to and receive
output from the server, all the work is going to be done on the server side.
Client:
——
Once the client program is run, it should connect to the server on a socket and port that you
chose for the server. Once that is established the client program should print a menu of choices
to allow the user to take certain actions:
1. Register/Login
2. Send an Email
3. Receive Email
4. Quit
1. Register/Login: In this request, you will inter a username and a password to register
an email account, for example the following can happen:
Please Enter a unsername: ahmed
Please Enter a password: password1
If the user already exists, then you will be logged in, otherwise it will create a new
user. All of this is going to be done on the server side. The server is going to keep track
of the users and their email.
NOTE: You should not be able to send or receive emails unless you login/register first. Also,
Once you register or login, you shouldn’t be able to do that again.
2. Send an Email: This is where the client program will ask you for a usernmame to send to,
a subject line, and a one line message to be entered. Here’s a scenario:
To: husky
Subject: Hello
Contents: I really like this assignment.
Once you finish, all this information is going to be sent to the server, or you can send it
as you type it. The server will store the email and the subject of the email for the user to
whom you sent it.
3. Receive email: Once you make a selection a list of emails that were sent to you is going to be
displayed. Here’s a scenario:
1. Subject: “Assignment 1”
2. Subject: “Let’s go play soccer”
3. Subject: “The book is in”
Enter your choice: 2
Once you enter the choice the content of the message should show up as follows:
Subject: Let’s go play soccer
There is no rain or snow today, do you want to go play soccer at 4?
Enter 1 to delete, 2 to keep: 1
If you enter 1 the message is deleted, otherwise it’s kept for the next time you read your email.
4. Quit: The client should keep running in a loop until you tell it to quit. Once it quits you close the
socket and close the program.
Server:
——-
The server is a process that is running forever waiting for requests from clients, so you may run as many
clients as you want to connect to the server. So, you can have a client to register a user, then
send an email and quit. Another client after that, can login and do the same. A third client can
run and read the emails. Etc.
The server once it receives a request from the client it just performs the operation:
1. Register a user: Store the username in an array and keep track of it as long as the server is running.
2. Send an email: Find the username and store the email to be associated with the username.
3. Receive an email: send back all the emails associated with the logged in user.
4. Quit the connection with that client.
Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."