Introduction
Recently I got myself introduced to socket programming. I read through many books and articles to get an insight into the subject. After learning a bit, I decided to share my knowledge with the world. For this purpose, I created a simple console based chat application. I hope this will be a good reference code for C++ socket programming. I am going to introduce the following concepts to you here.
What is Chat Client Server?
The demo project given along with this article consists of two console-based applications.
Chat Server
Chat server is an application which does the following operations:
- Listens for incoming calls from clients. Client running in any PC can connect to the server if IP address of the server is known.
- Listens for messages from all the connected clients.
- Broadcasts the message from clients to all the clients connected to the server.
- You can also type-in messages in the server, which will be broadcasted to all the clients.
Chat Client
Chat client does the following things:
- Sends messages to server as well as to all the connected clients.
- Views the messages from all the clients and server.
Please download the PDF document to read the rest of the documentation. I have created a PDF because the article consists of 2-3 diagrams.