protected void _connectAction_()

in src/main/java/org/apache/commons/net/ftp/FTP.java [251:282]


    protected void _connectAction_(final Reader socketIsReader) throws IOException {
        super._connectAction_(); // sets up _input_ and _output_
        if (socketIsReader == null) {
            _controlInput_ = new CRLFLineReader(new InputStreamReader(_input_, getControlEncoding()));
        } else {
            _controlInput_ = new CRLFLineReader(socketIsReader);
        }
        _controlOutput_ = new BufferedWriter(new OutputStreamWriter(_output_, getControlEncoding()));
        if (connectTimeout > 0) { // NET-385
            final int original = _socket_.getSoTimeout();
            _socket_.setSoTimeout(connectTimeout);
            try {
                getReply();
                // If we received code 120, we have to fetch completion reply.
                if (FTPReply.isPositivePreliminary(_replyCode)) {
                    getReply();
                }
            } catch (final SocketTimeoutException e) {
                final IOException ioe = new IOException("Timed out waiting for initial connect reply");
                ioe.initCause(e);
                throw ioe;
            } finally {
                _socket_.setSoTimeout(original);
            }
        } else {
            getReply();
            // If we received code 120, we have to fetch completion reply.
            if (FTPReply.isPositivePreliminary(_replyCode)) {
                getReply();
            }
        }
    }