How do i combine two bytes from network order into a usual short?
How do i combine two bytes 开发者_高级运维from network order into a usual short ?
Have you tried:
short value = (short) ((byte1 << 8) | byte2);
I can't remember network order off the top of my head, but if that's not right, just swap round byte1
and byte2
:)
IPAddress.NetworkToHostOrder(BitConverter.ToInt16(...))
精彩评论