added error handling and port validation
fixed tests
Merge pull request #266 from jembi/tcpport

Tcpport