----Lato server
Private Sub Winsock1_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim Dati As String
Dim Comando As String * 2
Dim Dato As String
Winsock1(Index).GetData Dati
Comando = Left(Dati, 2)
Dato = Mid(Dati, 3)
Select Case Comando
Case "00":
Open "c:\prova.rar" For Binary As Index
Seek Index, Dato
Winsock1(Index).SendData "01"
Case "01"
If LOF(Index) - Loc(Index) >= 4096 Then
Dato = Input(4096, #1)
Else
Dato = Input(LOF(Index) - Loc(Index), Index)
Close Index
End If
DoEvents
Winsock1(Index).SendData "01" & Dato
End Select
End Sub
-Lato client
Dim Dati As String
Dim Comando As String * 2
Dim Dato As String
Winsock4(Index).GetData Dati
Comando = Left(Dati, 2)
Dato = Mid(Dati, 3)
Select Case Comando
Case "01"
Put #2, , Dato
ListView1.ListItems(Index).SubItems(3) = CLng(ListView1.ListItems(Index).SubItems(3)) + Len(Dato)
If ListView1.ListItems(Index).SubItems(3) = ListView1.ListItems(Index).SubItems(2) Then
Else
DoEvents
Winsock4(Index).SendData "01"
End If
End Select