Hi there.
I want to connect two or more computer using server/cliente method i want to use also winsock but i don“t have any code do do that, where can i get the code for the server and the client, thank you.
numibesi
Printable View
Hi there.
I want to connect two or more computer using server/cliente method i want to use also winsock but i don“t have any code do do that, where can i get the code for the server and the client, thank you.
numibesi
This will help you learn winsock: http://www.vbsquare.com/articles/comms/
Tx for the link but i tried and i keep getting lots of errors, so i tried to download the demo but some files are missing so i stuck again. Any idea.
numibesi
If you will tell us what errors you are getting, that would help us to figure out what is wrong.
Server
ClientCode:Private Sub Form_Load()
Winsock1.Protocol = sckTCPProtocol
Winsock1.LocalPort = 1212
Winsock1.Listen
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Dim strData As String
Winsock1.SendData "Hello From Server" 'the prob is here
Text1.Text = Text1.Text & strData
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
Winsock1.GetData strData, vbString
Text1.Text = Text1.Text & strDataIP
End Sub
The prob is on the server when i try to connect it says wrong prtocol etc.Code:Private Sub Command1_Click()
Winsock1.SendData "Client here!"
End Sub
Private Sub Form_Load()
IP = "127.0.0.1"
Port = "1212"
Winsock1.Protocol = sckTCPProtocol
Winsock1.Connect IP, Port
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Text1 = Text1 & bytesTotal
End Sub
Change it to:Quote:
Code:Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Dim strData As String
Winsock1.SendData "Hello From Server" 'the prob is here
Text1.Text = Text1.Text & strData
End Sub
Code:Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Dim strData As String
Winsock1.Close
Winsock1.Accept requestID
Winsock1.SendData "Hello From Server"
Text1.Text = Text1.Text & strData
End Sub
That part now works but when i try to do this:
it gives me the same error wrong protocol......Code:Private Sub Command1_Click()
Winsock1.SendData "Still connected"
End Sub