added support for advertised port
changed TCP SIGPIPE to EPIPE