开发者

Does network byte order matter for proprietary protocols?

开发者 https://www.devze.com 2023-03-29 04:42 出处:网络
So I\'ve got a custom binary protocol that runs over UDP. My source is a little-endian embedded device, with the transmit basically being send(packed struct) .My destination devices are overwhelmingl

So I've got a custom binary protocol that runs over UDP.

My source is a little-endian embedded device, with the transmit basically being send(packed struct) . My destination devices are overwhelmingly going to be little endian PCs.

I got a request to change to network byte order. My instant response was "not a chance". I'm not seeing any point in going and flipping every one of my 100+ fields, a mix of 2 to 8 byte integers, along with floats and doubles, and then making 开发者_如何学运维most all of my users turn right around and flip them all back, and dealing with all the minor coding errors on both sides.

Am I missing something? Does network byte order really matter today? Did it really ever matter? Specifying what the byte order is obviously critically important, but beyond that, who really cares?


There is no need to switch to network byte order whatever the other machines on the network use - you are perfectly free to declare that the XPav protocol uses little-endian values.

Of course when it becomes an international standard that might be a bit of a problem - but that's in the future.

0

精彩评论

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

关注公众号