Click here to Skip to main content
13,901,646 members
Click here to Skip to main content
Add your own
alternative version

Stats

289.3K views
40.4K downloads
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

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.

  • 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.

License

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

Share

About the Author

Boby Thomas P
Software Developer (Senior) DWS
Australia Australia

You may also be interested in...

Comments and Discussions

 
QuestionConnecting to server Pin
Member 135619456-Dec-17 8:22
memberMember 135619456-Dec-17 8:22 
QuestionRun the project Pin
Member 135595355-Dec-17 5:09
memberMember 135595355-Dec-17 5:09 
QuestionProblem here! Pin
Member 1216378624-Nov-15 4:29
memberMember 1216378624-Nov-15 4:29 
AnswerRe: Problem here! Pin
Member 1235688228-Feb-16 1:23
memberMember 1235688228-Feb-16 1:23 
Questionasdf Pin
Member 1127666730-Nov-14 22:58
memberMember 1127666730-Nov-14 22:58 
GeneralThanks for Sharing Pin
ripon12323-Jun-13 8:57
memberripon12323-Jun-13 8:57 
QuestionHow would you make it so, you wouldn't receive your own messages? Pin
Member 939065929-Aug-12 0:47
memberMember 939065929-Aug-12 0:47 
Questionmfc Pin
ZarokovM30-Jul-12 9:56
memberZarokovM30-Jul-12 9:56 
QuestionClient Server between windows and linux Pin
abhishek3170420-Feb-12 22:02
memberabhishek3170420-Feb-12 22:02 
GeneralMy vote of 1 Pin
Zeshan Khan15-Jan-12 20:45
memberZeshan Khan15-Jan-12 20:45 
GeneralRe: My vote of 1 Pin
Member 1116586718-Nov-17 8:48
memberMember 1116586718-Nov-17 8:48 
GeneralMy vote of 4 Pin
sonu janjua28-Oct-11 2:27
membersonu janjua28-Oct-11 2:27 
GeneralMy vote of 5 Pin
peejays11-Oct-11 3:57
memberpeejays11-Oct-11 3:57 
QuestionAfxwin.h not found Pin
Member 808865716-Jul-11 0:51
memberMember 808865716-Jul-11 0:51 
AnswerRe: Afxwin.h not found Pin
peejays11-Oct-11 3:58
memberpeejays11-Oct-11 3:58 
GeneralRe: Afxwin.h not found Pin
zuiopvbnm10-Dec-12 5:00
memberzuiopvbnm10-Dec-12 5:00 
Questionthanks for sharing Pin
ClaireClaire12-Jul-11 20:39
memberClaireClaire12-Jul-11 20:39 
GeneralQuestion Pin
franchela19-Mar-11 5:12
memberfranchela19-Mar-11 5:12 
GeneralUnhandled exception Pin
ad_robot7-Jan-11 3:07
memberad_robot7-Jan-11 3:07 
GeneralMy vote of 4 Pin
Gokulnath00726-Dec-10 20:52
memberGokulnath00726-Dec-10 20:52 
Generalc code for chat server........plzzzzzzzzzz...urgent.......... Pin
ankit1011873-Apr-10 3:37
memberankit1011873-Apr-10 3:37 
Generalplzzzzzzzzzzzz Pin
harsh_amity1-Apr-10 21:10
memberharsh_amity1-Apr-10 21:10 
QuestionConnectin to my server on remote machine Pin
mehul959526-Mar-10 5:25
membermehul959526-Mar-10 5:25 
GeneralMy vote of 1 Pin
sathiyapraka7-Jan-10 22:44
membersathiyapraka7-Jan-10 22:44 
Generalthnx Pin
harshmttl22-Jan-09 7:21
memberharshmttl22-Jan-09 7:21 

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