<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _server_connect(self, s):
 """ Sets up a TCP connection to the server. """

        self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self._socket.setblocking(0)
        self._socket.settimeout(1.0)

        if self.options["tcp_nodelay"]:
            self._socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)

        self.io = tornado.iostream.IOStream(self._socket,
            max_buffer_size=self._max_read_buffer_size,
            max_write_buffer_size=self._max_write_buffer_size,
            read_chunk_size=self._read_chunk_size)

        # Connect to server with a deadline
        future = self.io.connect((s.uri.hostname, s.uri.port))
        yield tornado.gen.with_timeout(
            timedelta(seconds=self.options["connect_timeout"]), future)

        # Called whenever disconnected from the server.
        self.io.set_close_callback(self._process_op_err)