-
Compile the server.cpp and client.cpp programs on your PC by typing the following commands inside Linux terminal:
g++ server.cpp -o s -lpthread
g++ client.cpp -o c -lpthread
-
Open up multiple terminals in your system. (Let’s say 3).
- For the first terminal, get the server started up and running. Use the following command to run the server:
./s PORT_NUMBER
- For the second terminal get the first client running using the following:
./c IP_ADDRESS PORT_NUMBER
- For the third terminal get the second client running using the following:
./c IP_ADDRESS PORT_NUMBER
- For the first terminal, get the server started up and running. Use the following command to run the server:
-
The following commands are valid when no connection has been established (on the client-side):
- GET (Used for printing the list of all the client-ids connected to the server along with their status - FREE or BUSY). FREE status is displayed for the client who is connected to the server, but not connected to some other client for chatting.
- BUSY status is displayed for the client who is connected to the server and chatting with someone else.
- CONNECT <Client_ID> (It is used to connect the current client with another client who is having FREE status).
-
After the two clients are connected, directly type in the messages that you want to send to the other client and the same can be done from the other side. (Note: You cannot send a message if you are not connected to some client/until your status is FREE).
-
In order to end the chatting/ connection with the other client, type #GOODBYE# command inside the client terminal. This results in the disconnection of the two clients.
-
Note: The clients still remain connected to the server.
-
In order to make a client disconnect from the server, type #CLOSE# command inside the terminal of the respective client. This results in the closing of the connection between client and server.
-
Notifications
You must be signed in to change notification settings - Fork 1
arampuria19/Client-Chats
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published