CSC645/745 COMPUTER NETWORKS
The goal of this project is to write simple client and server programs for text
messaging and Internet chatting. The programming language is C and the
operating system is Linux.
Write a server program and a client program. The server manages a number of
client accounts, each having a username and a password.
Start the server first. When a client process is started, it has a menu for six
0. Connect to the server
1. Get the user list
2. Send a message
3. Get my messages
4. Initiate a chat with my friend
5. Chat with my friend
These functions allow the client to log onto the server through a TCP connection
using his/her username and password, get the list of other users on the server,
send a text message to another user, check his/her own text messages that were
left by other users, and perform chat with another user.
3. Sample Code
We provide sample code consisting of an “echo” server program and a client
program. The client establishes a TCP connection with the server, and sends a
message to the server, which will echo the message back to the client for display.
Essentially, it gives you a programming template that you can follow to write
your own networking program.
Use the following scenario for demo. The server maintains two client accounts.
One is for Alice, and the other is for Bob. Alice logs onto the server first. She gets
the user list and sees Bob. She sends a text message to Bob. The message carries
Alice’s IP address x and a port number y. After that, Alice selects “4. Initiate a
chat with my friend”, which terminates the TCP connection to the server, and
waits on port y for chatting with Bob. Next, Bob logs onto the server. He logs on
and retrieves his text messages. After seeing Alice’s message, Bob selects “5. Chat
with my friend”, which terminates the TCP connection to the server, and starts a
new TCP connection to Alice on port y. Then, Alice and Bob type in turn, and the
text typed by one will be sent to the other for display.
More details can be found from the demo video posted on iLearn.
Submit one ZIP file consisting of all source files and executables to the regular
submission link on iLearn.