Quote:
Originally Posted by RAzR Creations
i am making a program that i want to connect to 2 computers over the internet using remotehostip what i did was on the form load event i did label1.caption = serversock.remotehostip but nothing shows up but i also want the program to auto detect it just like mine is 65.80.200.47 i want it to auto detect it and put it in the label caption can anyone help?
|
Even though your query is old I will put this up incase 1 you still need help with it or 2 If another person wants to set up a LAN Chat System. Note you need 2 sides or 2 small progyz, 1 is the server and the other is the client, Client has to be on any PC that the server wants to chat with. Complete source code for both is below. This will only work on/over or through a LAN system and will not work over the Internet
LAN Chat System
server side is as follows
Private Sub cmdSend_Click()
On Error GoTo NoConnection
Winsock1.SendData "Severer : " + txtSend
NoConnection:
Exit Sub
End Sub
Private Sub Form_Load()
Winsock1.LocalPort = 80
Winsock1.Listen
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Accept requestID
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim GetMessage As String
Winsock1.GetData GetMessage
txtChat = txtChat + GetMessage + vbCrLf
End Sub
Client side is as follows
Private Sub cmdSend_Click()
Winsock1.SendData "Client : " & txtSend
txtMain = txtMain & "Client : " & txtSend & vbNewLine & vbCrLf
End Sub
Private Sub newcon_Click()
Dim NewIP As String
NewIP = InputBox("Please put in the IP of your buddy or PC on the network to connect to")
Winsock1.Close
Winsock1.Connect NewIP, 80
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim GetMessage As String
Winsock1.GetData GetMessage
txtMain = txtMain & GetMessage & vbNewLine & vbCrLf
End Sub