https://github.com/tvheadend/tvheadend/blob/master/src/htsmsg_binary.c#L224 is how it's written to the stream. No htonl there.