Port selection and ignore SIGPIPE