Click here to Skip to main content
13,899,733 members
Click here to Skip to main content
Add your own
alternative version


78 bookmarked
Posted 6 May 2006
Licenced CPOL

Chat Client Server

, 18 May 2007
Rate this:
Please Sign up or sign in to vote.
An implementation of chat client and server with win32 sockets
Sample Image - chat_client_server.jpg - Click to enlarge image


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.

  • Sockets
  • Multi threading

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.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Boby Thomas P
Software Developer (Senior) DWS
Australia Australia

You may also be interested in...

Comments and Discussions

GeneralRespected sir Pin
shakher sumsher21-Jan-09 18:54
membershakher sumsher21-Jan-09 18:54 
GeneralC cde for chat server Pin
avinashk1429-Aug-08 0:08
memberavinashk1429-Aug-08 0:08 
GeneralI want to implement a chat server/client Pin
richa.cseit28-Feb-08 3:58
memberricha.cseit28-Feb-08 3:58 
GeneralRe: I want to implement a chat server/client Pin
chandreshpratapsrivastava23-Mar-09 4:18
memberchandreshpratapsrivastava23-Mar-09 4:18 
QuestionWant to develop a chat client Pin
dipuThegr814-Nov-07 18:16
memberdipuThegr814-Nov-07 18:16 
Generalwchar_t Pin
Man_cool9-Jul-07 19:42
memberMan_cool9-Jul-07 19:42 
QuestionError? Pin
XHungChung10-Nov-06 0:33
memberXHungChung10-Nov-06 0:33 
AnswerRe: Error? Pin
Boby Thomas P10-Nov-06 0:37
memberBoby Thomas P10-Nov-06 0:37 
Generalbehavior after cable break Win2k/ Winxp Pin
Bennet Yee12-May-06 20:13
memberBennet Yee12-May-06 20:13 
Generali have an idea Pin
noise@ASU9-May-06 15:52
membernoise@ASU9-May-06 15:52 
GeneralRe: i have an idea Pin
Boby Thomas P9-May-06 21:22
memberBoby Thomas P9-May-06 21:22 
Generalintegration of project Pin
dimas757-May-06 9:54
memberdimas757-May-06 9:54 
GeneralRe: integration of project Pin
mysterious_caveman10-Jun-07 10:43
membermysterious_caveman10-Jun-07 10:43 
Generalthanks Pin
raul_sfk7-May-06 0:48
memberraul_sfk7-May-06 0:48 
GeneralRe: thanks Pin
Boby Thomas P7-May-06 8:56
memberBoby Thomas P7-May-06 8:56 
Generalinfo required Pin
SunithaC7-May-06 0:43
memberSunithaC7-May-06 0:43 
GeneralRe: info required Pin
Boby Thomas P7-May-06 8:56
memberBoby Thomas P7-May-06 8:56 
GeneralRe: info required Pin
roninttk9-May-06 22:13
memberroninttk9-May-06 22:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web05 | 2.8.190306.1 | Last Updated 19 May 2007
Article Copyright 2006 by Boby Thomas P
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid