I wonder if it wouldn't be easier to use e.g. `GDataOutputStream` instead of manually creating these temporary buffers and printf()-ing values to them.