开发者

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(...))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜