Click here to Skip to main content
Click here to Skip to main content
Go to top

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

Comments and Discussions

 
GeneralThanks for Sharing Pinmemberripon12323-Jun-13 8:57 
QuestionHow would you make it so, you wouldn't receive your own messages? PinmemberMember 939065929-Aug-12 0:47 
Questionmfc PinmemberZarokovM30-Jul-12 9:56 
QuestionClient Server between windows and linux Pinmemberabhishek3170420-Feb-12 22:02 
GeneralMy vote of 1 PinmemberZeshan Khan15-Jan-12 20:45 
GeneralMy vote of 4 Pinmembersonu janjua28-Oct-11 2:27 
GeneralMy vote of 5 Pinmemberpeejaysales11-Oct-11 3:57 
QuestionAfxwin.h not found PinmemberMember 808865716-Jul-11 0:51 
AnswerRe: Afxwin.h not found Pinmemberpeejaysales11-Oct-11 3:58 
GeneralRe: Afxwin.h not found Pinmemberzuiopvbnm10-Dec-12 5:00 
Questionthanks for sharing PinmemberClaireClaire12-Jul-11 20:39 
GeneralQuestion Pinmemberfranchela19-Mar-11 5:12 
GeneralUnhandled exception Pinmemberad_robot7-Jan-11 3:07 
GeneralMy vote of 4 PinmemberGokulnath00726-Dec-10 20:52 
Generalc code for chat server........plzzzzzzzzzz...urgent.......... Pinmemberankit1011873-Apr-10 3:37 
Generalplzzzzzzzzzzzz Pinmemberharsh_amity1-Apr-10 21:10 
QuestionConnectin to my server on remote machine Pinmembermehul959526-Mar-10 5:25 
GeneralMy vote of 1 Pinmembersathiyapraka7-Jan-10 22:44 
Generalthnx Pinmemberharshmttl22-Jan-09 7:21 
GeneralRespected sir Pinmembershakher sumsher21-Jan-09 18:54 
GeneralC cde for chat server Pinmemberavinashk1429-Aug-08 0:08 
GeneralI want to implement a chat server/client Pinmemberricha.cseit28-Feb-08 3:58 
GeneralRe: I want to implement a chat server/client Pinmemberchandreshpratapsrivastava23-Mar-09 4:18 
QuestionWant to develop a chat client PinmemberdipuThegr814-Nov-07 18:16 
Generalwchar_t PinmemberMan_cool9-Jul-07 19:42 

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

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

| Advertise | Privacy | Mobile
Web03 | 2.8.140905.1 | Last Updated 19 May 2007
Article Copyright 2006 by Boby Thomas P
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid