Simple Client Server chat program using Winsock control


Many people want to be able to write a program that chats between two computers. This Visual Basic 6 source code sample shows exactly how to do that. It uses the Winsock control and demonstrates how you can use VB6 to create both the client and server. If you would like step by step directions in how to do this check out our tutorial: A Client server Chat program using Winsock control tutorial.


Download Visual Basic 6 Source Code Sample 

If you enjoyed this post, subscribe for updates (it's free)

qoeue costumers

can you help me for using socket program in vb6, which are i want to write queue costumer program?

Cyber Software

I Would like to create Cyber maintenance software.. pls suggest me some open source code in vb..


Out of what I can see here...All I can say is that I understand more here than when in class. Your explanation is clear and every one is bound to understand. Thank you and keep up your efforts in helping we upcoming programmers. May your willingness to help pay you back in one way or another. Thanks.

really big help from you

i would like to thank the author of this tutorial....this has really been a great place for me since i am just a beginner in visual basic...i really appreciate all the time and effort you give in this tutorial and really thankful for as the another commentator said "youre willing to teach others when you really don't have to" ...i wish you goodluck sir!




better client-server replacement for INet?

This is great, but is there a way to get this to communicate client-server, via HTTP? I have been using VB6 INet Control to do this, but it is quirky/buggy, and doesn't provide me with the flexibility I desire. I have heard that Winsock is supposed to be faster. Can this be used as a better replacement for INet? How could I adapt this to communicate with a web server like INet, instead of just another PC? Thanks!

thanks for sharing!

thanks for sharing!

winsock control in vb 6.0

plz help me on how to use the winsock control in vb 6.0. our program is about the networking secuirty policy

adding password to winsock

hiii ....

i want to know ... that how can we add a password when a client wants a connection request to the server ?

Chat in Intranet

hay ur prog is wrkin ... but once the connection state is true it s wrking but once i close the program the con s not closed
Thank u!

about port nomber

i can not get port number , program throws error about port number . how i insert the port number plz rpl


I'm a newbie but now I can make Client Server Program because of your tutorial. Thank you


thanks , thanks , thanks

in need help with a program that manages a rental business

Im supposed to make an application that will manage a car rental and ive made all the forms but when i run the program it gives me an error "Method or data member not found (Error 461)"
hares the code
"Private Sub Command1_Click()
Dim DatConn As New ADODB.Connection
Dim myRecordSet As New ADODB.Recordset
Const myconnect = "Provider = Microsoft.jet.OLEDB.4.0;Data Source=c:\Project.mdb"
Call DataConn.Open(Myconnector)
Call myRecordSet.Open("SELECT*from tblCars where [CarID]=" & (txtCarID) & "", DataConn, adOpenDynamic, adLockOptimistic)
If myRecordSet.EOF = True Then
msg "The table is empty"
End If
myRecordSet.EOF = False
If myRecordSet("CarID") = txtCarID Then
lblModel.Text = myRecordSet("Model")
lblRegistration.Text = myRecordSet("Registration")
lblMillage.Text = myRecordSet("IMillage")

Exit Sub
End If
If myRecordSet.EOF = True Then
MsgBox "The record does not exist"
Exit Sub
End If
End Sub"

"rivate Sub cmdAddcar_Click()
Dim CustConn As New ADODB.Connection
Dim CustDBase As New ADODB.Recordset
Const dataCon = "Provider=Microsoft.jet.oledb.4.0;data source=c:\Poject.mbd\Cars"
Call CustConn.Open(dataCon)
Call CustDBase.Open("tblCars", CustConn, adOpenDynamic, adLockOptimistic)
CustDBase("CarID") = txtCarID.Text
CustDBase("CarModel") = txtModel.Text
CustDBase("Make") = txtmake.Text
CustDBase("CarRegistration") = txtRegistration.Text
CustDBase("Millage") = txtMillage.Text
CustDBase("Available") = 1
txtCarID.Text = ""
txtModel.Text = ""
txtRegistration.Text = ""
txtModel.Text = ""
End Sub

Plz help


it's bcoz that you hve entered the cmdADDcar as
"rivate Sub_cmdAddcar"

i think your error is in

i think your error is in these lines

lblModel.Text = myRecordSet("Model")
lblRegistration.Text = myRecordSet("Registration")
lblMillage.Text = myRecordSet("IMillage")

if i'm not mistaken that is a label, labels do not have .text property. they have .caption property.
Every time you method or data member not found. always check the .property part.
I hope it helps. Good luck with the program

created a DC++ Client

I took this tool, and created a custom DC++ chat client for P2P file sharing and to control the hub settings with other windows etc. All possible because of your little program.

dvd rom intilazing

oh can i make a app. that will read what on my disc in the dvd rom and copie it to hdd or save in temp for burning????? can anyone help me please email me back


Eow...!, nice tutorial, this site is very helpful....!
wish that you have more tutorials.....!!!
keep up the good work!!!! thank you!!

hola chilangos

hola lokos ps namas pasaba a desirles k se les va kaer el kanton i k pasen a www/ esta chevere y hay mas codigos VB6 jaja arre

winsock with authentication


Having a problem with this winsock thing.
The server need username and password authentication. How do i do that ?

Pls advice. Thank you.

Best Regards,

to creat voice chating program

i wanna creat my own voice chating program plz help me

Simple networking?

how can i run an application in a computer in a LAN?

please give me a simple example for just two computers.
One from which I will attempt to run notepad.exe in the other computer.
Just a button in a form that when clicked will run the application notepad.exe in the other computer

is it possible?

thanks in advance!

help pls...

do you have some invoice system? or program something like that... pls help me..


this program is so good. im currently working a program that very similar to your's but ive encounterd some errors so ive decided to check on the net. im very lucky that ive found this site and your program.
thank you!

chat over internet

this works in a system.
what if i want it over lan or wan or internet what do i do


salamat s gumawa nito!!!

thanks for the help,,it was very nice of you.. ^^


SimpleClientServer Code

I have dowloaded the sample code frm here..I am encountering an Error Which say....
Error 2 Overload resolution failed because no accessible 'GetData' accepts this number of arguments.

Could anyone tel me wad does tis means..wad must i do inorder to gt tis working..Thank You

it's cuz u sent an empty

it's cuz u sent an empty text and the senddata could not send an empty text so u have to validate it xD

How do I do that?