using ntohl and htonl to write and read packet num