'Initiate the outgoing connection attempt.
@note: Applications do not need to call this method; it will be invoked
internally as part of L{IReactorTCP.connectTCP}.'

def doConnect(self):

    self.doWrite = self.doConnect
    self.doRead = self.doConnect
    if (not hasattr(self, 'connector')):
        return
    err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
    if err:
        self.failIfNotConnected(error.getConnectError((err, strerror(err))))
        return
    try:
        connectResult = self.socket.connect_ex(self.realAddress)
    except socket.error as se:
        connectResult = se.args[0]
    if connectResult:
        if (connectResult == EISCONN):
            pass
        elif ((connectResult in (EWOULDBLOCK, EINPROGRESS, EALREADY)) or ((connectResult == EINVAL) and (platformType == 'win32'))):
            self.startReading()
            self.startWriting()
            return
        else:
            self.failIfNotConnected(error.getConnectError((connectResult, strerror(connectResult))))
            return
    del self.doWrite
    del self.doRead
    self.stopReading()
    self.stopWriting()
    self._connectDone()
