linux - 关于网络字节序的一些疑问
大家讲道理
大家讲道理 2017-04-17 16:52:11
0
1
563
大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
刘奇

It is indeed for a certain field. A one-byte field does not matter the byte order, so only fields with more than double bytes have byte order problems. Convert a multi-byte field to network byte order when assembling a data packet. After a data packet is assembled, the packet looks like this, and it also looks like this when transmitted on the network. When the data reaches the destination, the fields need to be converted into the byte order of the own host for parsing

The reverse will only occur when a host with a different byte order than the network sends multi-byte fields

If you have ever written a network program you will understand. The simplest one can be to write a ping program using raw sockets, which will use packet assembly and have multi-byte fields

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template