关于vb的winsock通信
Private Sub wskb_DataArrival(ByVal bytesTotal As Long)Static i As Long
i = 0
Dim myFile() As Byte
Dim myLong As Double
Dim myPath As String
Dim length As Integer
length = 0
myPath = VB.App.Path & "\map.jpg"
Do While (1)
ReDim myFile(0 To 4999) '此处也可以是(0 To bytesTotal-1)
wskb.GetData myFile '重复接收操作,这种思路对着没?
If i <= 0 Then
Open myPath For Binary As #1 '新建文件
Put #1, length + 1, myFile '将收到的数据写入新文件中
Else
If FileLen(myFile) < 5000 Then //这块运行时说文件不存在
Put #1, length + 1, myFile
Exit Do
Else
Put #1, length + 1, myFile
End If
End If
i = i + 1
length = length + 5000
Loop
Close #1 '关闭'记录文件长度
lenth = lenth + UBound(myFile) - LBound(myFile) + 1
' Picture2.Picture = LoadPicture(VB.App.Path & "\map.jpg")
End Sub
求助
我这是客户端接收服务器端发来得图片,
重复接收,
可是怎么样判断是最后一次发来的数据(最后一次缓冲区未存满)
请指点