socket: fix port endianness issues