注册 登录
编程论坛 VB.NET论坛

Axwinsock控件接收

yushenjueli 发布于 2020-03-11 19:31, 2135 次点击

只有本站会员才能查看附件,请 登录

程序代码:
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接收,上述代码单字节接收没问题,请问如何多字节接收?
0 回复
1