def connect(self, timeout=<NUM_LIT>):
<EOL>if self.socket:<EOL><INDENT>raise TensorForceError("<STR_LIT>" +<EOL>"<STR_LIT>".format(self.host, self.port))<EOL><DEDENT>self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)<EOL>if timeout < <NUM_LIT:5> or timeout is None:<EOL><INDENT>timeout = <NUM_LIT:5><EOL><DEDENT>err = <NUM_LIT:0><EOL>start_time = time.time()<EOL>while time.time() - start_time < timeout:<EOL><INDENT>self.socket.settimeout(<NUM_LIT:5>)<EOL>err = self.socket.connect_ex((self.host, self.port))<EOL>if err == <NUM_LIT:0>:<EOL><INDENT>break<EOL><DEDENT>time.sleep(<NUM_LIT:1>)<EOL><DEDENT>if err != <NUM_LIT:0>:<EOL><INDENT>raise TensorForceError("<STR_LIT>".<EOL>format(self.host, self.port, err, errno.errorcode[err], os.strerror(err)))<EOL><DEDENT>
Starts the server tcp connection on the given host:port.

Args:
    timeout (int): The time (in seconds) for which we will attempt a connection to the remote
        (every 5sec). After that (or if timeout is None or 0), an error is raised.