Htons & ntohl at datatransfer

I always wondered why I should not use htons / ntohl when using write / read? (At least all the examples I've seen so far do not.)

How do you know that bytes received have the correct entity?

+5
source share
1 answer

Well, you need to, if you ever intend to exchange files between systems of another limb - it's just that the problem tends to appear less often in the context of files than with network protocols, and therefore is often ignored.

+1
source

All Articles