-
How can I send multiple strings with winsock was the question. It might not be very hard to type 'Winsock1.SenData' multiple times, but getting the strings to end up in different places isn't quite as easy (according to me). So what I want to know is: How can I make different strings which were sent through winsock, to go to different textboxes. I've seen a method using different functions such as 'InStr', 'Left$' and 'Mid' (or something like that), but I have no idea how to use these functions. Anybody wanna help me? Please?
-
On the sender's side :
Code:
Dim i As Long
Dim var_temp As String
For i = 0 to UBound(Textbox)
var_temp = var_temp & "_!_" & Textbox(i).Text
Next i
Winsock1.SendData var_temp
Then, on the receiver's side :
Code:
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim var_sockdata As String
Dim var_temp() As String
Dim i as long
Winsock1.GetData var_sockdata, vbString
var_temp = Split(var_sockdata, "_!_", -1,vbTextCompare)
For i = 0 To UBound(Textbox)
Textbox(i).Text = var_temp(i)
Next i
End Sub