开发者

Bytes alignment when sending packets

开发者 https://www.devze.com 2023-02-07 18:34 出处:网络
If I send a packet containing address, port and other stuff, would there be any alignment proble开发者_如何学Cm on the other side? (using socks 5 protocol)You don\'t mention which language you\'re pro

If I send a packet containing address, port and other stuff, would there be any alignment proble开发者_如何学Cm on the other side? (using socks 5 protocol)


You don't mention which language you're programming in. If you're using C or C++, there are functions like htons, htonl, ntohs, ntohl and more to standardize network data elements into a transportable format. This guide (among many others) will tell you how to write network portable code so differences in endianness will not bite you in the @ss.

0

精彩评论

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