Read Part 2 : The Client
$ gcc server.c -o server -lpthread $ gcc client.c -o client -lpthread
Now we run the server program and several client programs
Each client should first connect to the server by typing in:
login [alias]Here [alias] is optional, if it is not mentioned, the name will be set as Anonymous.
The name can be changed by the command:
alias [new_name]After this, you alias will be changed to the new name you have given.
To send a message to everyone connected at the moment:
To send a message to a specific alias:
whisp [user_alias] [message]If the target alias is not active at that moment, message will not be sent anywhere
You can disconnect from the server by typing:
logoutYou can again reconnect by using the login command
You can terminate the client by typing:
This is pretty much of it. Basically this is good for your C lab assignments regarding TCP / socket based chat clients. Here is a screen shot from my computer: