发:
Dim bytes(1) As Byte
bytes(0) = &HA
bytes(1) = &H9Winsock1.SendData (bytes)收:
Dim bytes(1) As Byte
Winsock1.GetData bytes, vbArray + vbByte
Debug.Print Chr(bytes(1)) + Chr(bytes(0))为什么打印出来,为0?协议为UDP协议。

解决方案 »

  1.   

    你想打印出什么?!
    你直接打印
    Debug.Print Chr(&HA) & Chr(&H9)
    会是什么出来???
      

  2.   

    Debug.Print bytes(1)
    Debug.Print bytes(0)
    打印的都是0通过watch看到,bytes(0),bytes(1)的内容都是0。为什么?
      

  3.   

    Dim bytes() As Byte
    Winsock1.GetData bytes, vbArray + vbByte
    Debug.Print cstr(bytes(1)) & cstr(bytes(0))
      

  4.   

    baoaya(点头) :
    打印的结果是:00。我把bytesTotal的内容打印出来,是:2。很奇怪,为什么bytes得到的是0呢?
      

  5.   

    Private Sub tcpClient_DataArrival(ByVal bytesTotal As Long)
        If bytesTotal > 0 Then
            Dim SendData as byte[20]
            tcpClient.GetData SendData, vbByte, bytesTotal
            Debug.Print cstr(SendData(0)) & cstr(SendData(1))
        end if
    end sub
      

  6.   

    limit(梦锦) :
    你可以收到非0的结果吗?为什么我试出来的结果,都是0呢?