vb中socket怎么以网络字节字节序发送报文
vb中的socket接口要求以4字节的长度发送报文,并且要以网络字节序发送报文长度,大家知道怎么用这个函数吗?Public Function vbSend(ByVal lngSocket As Long, strData As String) As Long
Dim arrBuffer() As Byte
Dim lngBytesSent As Long
Dim lngBufferLength As Long
lngBufferLength = Len(strData)
If IsConnected(lngSocket) And lngBufferLength > 0 Then
'Convert the data string to a byte array
arrBuffer() = StrConv(strData, vbFromUnicode)
'Call the send Winsock API function in order to send data
lngBytesSent = send(lngSocket, arrBuffer(0), lngBufferLength, 0&)
vbSend = lngBytesSent
Else
vbSend = SOCKET_ERROR
End If
End Function
用这个老提示报文长度不对