Click here to Skip to main content
11,924,800 members (57,274 online)
Click here to Skip to main content
Add your own
alternative version


56 bookmarked

Chat program

, 2 Dec 2002
Rate this:
Please Sign up or sign in to vote.
Simple chat program.

Sample Image - CSocket.jpg


This very simple Chat program was written by using VC++ 6 under Windows 2000. CSocketCli program creates a client socket. CSocket program creates a server socket. If you run the client program, you must specify the address of the other computer in the IP Address editbox in "the server program".

If the client is running but the server isn't running, you will receive an error in the editbox down in the client program, but if you connect you will receive "Connected" message in the chat editbox in the client program.

When you run the server, you don't need to do any thing; just wait until some client program connects with the server. This program handles multiple clients and you can have private chat with friends.

Important note: If you run the Client and the Server in the same computer, please write in the client IP Address textbox the address, then press Connect button and you will be connected to the server.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

essam el-nagar
Software Developer (Senior)
Saudi Arabia Saudi Arabia
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionHello! Pin
Member 103101355-Oct-13 4:06
memberMember 103101355-Oct-13 4:06 
QuestionThank you for easy to follow code for Client and Server Sides... Pin
Destiny7779-Feb-13 13:46
memberDestiny7779-Feb-13 13:46 
The sample code works very well.

Thank you very much for posting it here.


The only improvement that could be helpful to others would be to make 1 program to allow either side of the connection to be the host or the client depending on which side initiated the connection.


All in all... very nice Server and Client Chat Programs.

Thanks again!
GeneralFirewall Pin
AlexEvans22-Aug-10 0:22
memberAlexEvans22-Aug-10 0:22 
GeneralRe: Firewall Pin
Destiny7779-Feb-13 13:41
memberDestiny7779-Feb-13 13:41 
Questionhow are you Pin
cen_jin_long22-Feb-10 13:41
membercen_jin_long22-Feb-10 13:41 
GeneralDownload = 0kb Pin
codeinelogic8-Jan-09 8:53
membercodeinelogic8-Jan-09 8:53 
GeneralRe: Download = 0kb Pin
codeinelogic8-Jan-09 9:02
membercodeinelogic8-Jan-09 9:02 
GeneralThank you. Pin
Member 232736913-May-08 23:01
memberMember 232736913-May-08 23:01 
Generalhome edition Pin
vishal dhir24-Feb-07 21:16
membervishal dhir24-Feb-07 21:16 
Questionhow to use it in campus Pin
Member #368157930-Dec-06 1:05
memberMember #368157930-Dec-06 1:05 
Questionhow to use it in campus Pin
Member #368157930-Dec-06 1:04
memberMember #368157930-Dec-06 1:04 
Questionwhat is socket programming Pin
mahili19-Nov-06 22:28
membermahili19-Nov-06 22:28 
AnswerRe: what is socket programming Pin
kkyaw8823-Feb-07 11:45
memberkkyaw8823-Feb-07 11:45 
Generalvery usefull Pin
fserdary9-Aug-06 5:51
memberfserdary9-Aug-06 5:51 
Generalgood code Pin
Sujitmatrix2-May-06 5:21
memberSujitmatrix2-May-06 5:21 
Generalexcellent sample code Pin
George98765432122-Mar-06 23:15
memberGeorge98765432122-Mar-06 23:15 
GeneralCMD Pin
Pablo9836-Mar-06 12:37
memberPablo9836-Mar-06 12:37 
Generalgood job~~ Pin
rosenus12-Feb-06 5:58
memberrosenus12-Feb-06 5:58 
GeneralCheck the status Wether Connect to the internet or not Pin
Kutti Ra1-Oct-05 0:07
memberKutti Ra1-Oct-05 0:07 
Generalover the internet Pin
mesut_pak12-Mar-05 6:44
membermesut_pak12-Mar-05 6:44 
GeneralRe: over the internet Pin
Xiaozhou Ye6-Nov-05 22:10
memberXiaozhou Ye6-Nov-05 22:10 
Questionhow to make one application work as a server and client simultaneously Pin
syaks29-Nov-04 8:19
membersyaks29-Nov-04 8:19 
AnswerRe: how to make one application work as a server and client simultaneously Pin
Destiny7779-Feb-13 13:54
memberDestiny7779-Feb-13 13:54 
GeneralTransmit Image File Pin
Keel15-Jan-04 21:15
memberKeel15-Jan-04 21:15 
GeneralIPnr in list box Pin
JockeP24-Aug-03 19:41
memberJockeP24-Aug-03 19:41 
GeneralBind Error Pin
Hazem Nasereddin7-Jan-03 3:54
memberHazem Nasereddin7-Jan-03 3:54 
GeneralRe: Bind Error Pin
kaizer25-Jun-03 6:45
susskaizer25-Jun-03 6:45 
GeneralRe: Bind Error Pin
asimrehan131-Mar-13 9:47
memberasimrehan131-Mar-13 9:47 
GeneralThanks... Pin
Mustafa Bayer4-Dec-02 9:45
memberMustafa Bayer4-Dec-02 9:45 
GeneralChat With US DI Pin
Dany Cantin26-Nov-02 17:56
memberDany Cantin26-Nov-02 17:56 
GeneralRe: Chat With US DI <<< Liggity Lame Pin
Anonymous4-Dec-02 7:57
sussAnonymous4-Dec-02 7:57 
GeneralRe: Chat With US DI <<< Liggity Lame Pin
Dany Cantin5-Dec-02 4:30
memberDany Cantin5-Dec-02 4:30 
GeneralRe: Chat With US DI &lt;&lt;&lt; Liggity Lame Pin
Anonymous7-Jun-05 16:59
sussAnonymous7-Jun-05 16:59 
GeneralThread Data Pin
kmaz5-Aug-02 12:52
memberkmaz5-Aug-02 12:52 
QuestionHow to make it work Pin
Gautam9826-Jun-02 21:31
memberGautam9826-Jun-02 21:31 
AnswerRe: How to make it work Pin
tomdekok21-Jul-02 2:31
membertomdekok21-Jul-02 2:31 
AnswerRe: How to make it work Pin
ahkeR8-Mar-07 8:45
memberahkeR8-Mar-07 8:45 
GeneralClient Server Chat Pin
Munty5410-May-02 20:37
memberMunty5410-May-02 20:37 
GeneralRe: Client Server Chat Pin
bamaruckmani27-Sep-04 20:11
sussbamaruckmani27-Sep-04 20:11 
GeneralThank you!!!! Pin
Anonymous12-Mar-02 23:20
memberAnonymous12-Mar-02 23:20 
GeneralRe: Thank you!!!! Pin
tomdekok21-Jul-02 2:33
membertomdekok21-Jul-02 2:33 
GeneralYou have memory leaks Pin
Jacques11-Dec-01 17:00
memberJacques11-Dec-01 17:00 
Generalhelp if you can Pin
conwaytowers16-Oct-01 6:18
memberconwaytowers16-Oct-01 6:18 
Generalquestion Pin
Jordan25-Sep-01 20:11
memberJordan25-Sep-01 20:11 
GeneralThank you Pin
Uday T23-Jul-01 5:44
memberUday T23-Jul-01 5:44 
Generalnumber of users on this application Pin
radical8-Jun-01 5:35
memberradical8-Jun-01 5:35 
GeneralExplaination Pin
Maria Jothi29-May-01 20:46
memberMaria Jothi29-May-01 20:46 
GeneralRe: Explaination Pin
zarzor3-Dec-02 16:07
memberzarzor3-Dec-02 16:07 
GeneralThank You very much Pin
Amit Malik4-Apr-01 21:56
memberAmit Malik4-Apr-01 21:56 
QuestionHow to know when the ConnectionRequest occurs Pin
mhs20-Mar-01 19:54
membermhs20-Mar-01 19:54 

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.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.151125.3 | Last Updated 3 Dec 2002
Article Copyright 2001 by essam el-nagar
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid