主机字节序转网络字节序
//加上两个字节长度,再发送
byte[] bSend = new byte[buffer.Length + 2];
byte[] bLenth = BitConverter.GetBytes((ushort)IPAddress.HostToNetworkOrder((short)buffer.Length));
bSend[0] = bLenth[0];
bSend[1] = bLenth[1];
网络字节序转主机字节序
byte[] bLenth = new byte[2];
bLenth[0] = m_listRecbuf[0];
bLenth[1] = m_listRecbuf[1];
ushort iLenth = (ushort)IPAddress.NetworkToHostOrder((short)BitConverter.ToUInt16(bLenth, 0));