Chat application

By | 2002-06-01

Create a simple chat application betweenany two computers whose IP addresses you know. The DEMO here shows how to chat with your own computer .you can substitute your own IP with that of another person’s IP and create a seperate EXE running on his computer to chat with him /her
COOL!

Original Author: Vikramjit Singh

API Declarations

Code

'Open a project Exe. Put a winsock, and two textbox control ,named text2 and 'text3. Paste this code in it.
Private Sub Form_Load()
With Winsock1
.RemoteHost = "your machine IP" 'put your or someone else's IP here
.RemotePort = 1001
.Bind 1002
End With
chat1.Show
End Sub
Private Sub Text3_Change()
Winsock1.SendData Text3.Text
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
Winsock1.GetData strData
Text2.Text = strData
End Sub
'********************************************************************
'paste code below into another form having 2 text boxes and winsock
'control in the SAME project
'********************************************************************
Private Sub Form_Load()
With Winsock1
.RemoteHost = "your machine IP" 'put your or someone else's IP here
.RemotePort = 1002
.Bind 1001
End With
End Sub
Private Sub Text3_Change()
Winsock1.SendData Text3.Text
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
Winsock1.GetData strData
Text2.Text = strData
End Sub

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.