Axwinsock控件接收
程序代码:
Private Sub AxWinsock1_DataArrival(ByVal sender As Object, ByVal e As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles AxWinsock1.DataArrival Dim str As String Dim r As Integer Dim s As String Dim receive As Byte str = "" r = AxWinsock1.BytesReceived AxWinsock1.GetData(receive, vbByte, r) s = Hex(receive) TextBox1.Text = TextBox1.Text & s & " " If controlmode = 4 Then '设备通信 End If End Sub
设备通过串口转TCP模块,发送指令,PC端用Axwinsock接收,上述代码单字节接收没问题,请问如何多字节接收?