im trying to update all the conected sockets with the same data
the server accepts all clients and updates ok as single client
but when i try to loop though all the conected sockets it seems to just update the last client conected and mess up the others
not sure how to make it work any ideas plz : )
the server accepts all clients and updates ok as single client
but when i try to loop though all the conected sockets it seems to just update the last client conected and mess up the others
not sure how to make it work any ideas plz : )
Code:
Dim intCnt As Integer
Dim i As Integer
Dim j As Integer
Dim ind As Integer
For ind = 1 To intSockCnt 'Loop through the sockets
If Not winsock(ind) Is Nothing Then 'Make sure the array element exists
txtStatus.Text = txtStatus.Text & _
"updating: " & _
winsock(ind).RemoteHostIP & ":" & ind & vbCrLf
Set colToSend = New Collection
winsock(ind).SendData LISTTX & RS
boListTx = True
With ListView1
' Add the column headers to the collection
For i = 1 To .ColumnHeaders.Count
colToSend.Add LVHEADERS & US & .ColumnHeaders(i).Text & RS
Next i
End With
With ListView1.ListItems
' Add the Items and Sub Items to the collection
For i = 1 To .Count
colToSend.Add LVITEM & US & .Item(i) & RS
For j = 1 To ListView1.ColumnHeaders.Count - 1
colToSend.Add LVSUBITEM & US & .Item(i).SubItems(j) & RS
Next j
Next i
' Send the first record and remove it from the collection
' Subsequent records will be sent from the SendComplete event
winsock(ind).SendData colToSend.Item(1)
colToSend.Remove (1)
End With
End If
Next ind