Handle input end on shared memory without asserting.
Use proper cross-endian safe communication also for sending the port number.