VB SOCKET GETDATA问题
Dim totalData As String
Dim strData As String
Dim totalLen As Integer
Private Sub csock_DataArrival(ByVal bytesTotal As Long)
If csock.State <> sckConnected Then
Exit Sub
End If
If totalLen = 0 Then
totalData = ""
csock.GetData strData, vByte, 1024
Dim headLen As String
headLen = Left(strData, 1)
totalLen = Asc(headLen)
End If
csock.GetData strData, vByte, totalLen
If Len(totalData) < totalLen Then
totalData = totalData + strData
If Len(totalData) = totalLen Then
fun_allDataReceived
End If
End If
End Sub
先取包头 根据包头里取到的长度 取相应长度的信息 csock.GetData strData, vByte, totalLen 运行时这一行提示类型不匹配