Hostname can either be in the form of a hostname or an IP address represented as a string. If the hostname is not found as it is, hostname is assumed to be an IP address, and it is treated as such. If the lookup succeeds, a TCP connection is established with the specified port number on the remote host and a stream socket is returned. On any sort of error, an error code can be obtained with NetErrNo() and a message with NetErrStr().