Пример #1
0
            /// <summary>
            /// Swtiches FTP data connection to passive mode and connects to the sepcified FTP server.
            /// </summary>
            /// <param name="remoteEP">FTP server IP end point.</param>
            /// <exception cref="ArgumentNullException">Is raised when <b>remoteEP</b> is null.</exception>
            public void SwitchToPassive(IPEndPoint remoteEP)
            {
                if(remoteEP == null){
                    throw new ArgumentNullException("remoteEP");
                }

                m_pOwner.LogAddText("FTP data channel switched to Passive mode, connecting to FTP server '" + remoteEP.ToString() + "'.");

                // In passive mode we just need to connect to the specified FTP host.
                m_pSocket.Connect(remoteEP);

                m_TransferMode = FTP_TransferMode.Passive;

                m_pOwner.LogAddText("FTP Passive data channel established, localEP='" + m_pSocket.LocalEndPoint.ToString() + "' remoteEP='" + m_pSocket.RemoteEndPoint.ToString() + "'.");
            }
Пример #2
0
            /// <summary>
            /// Swtiches FTP data connection to active mode.
            /// </summary>
            public void SwitchToActive()
            {
                // In acvtive mode we must start listening incoming FTP server connection.
                m_pSocket.Listen(1);

                m_TransferMode = FTP_TransferMode.Active;

                m_pOwner.LogAddText("FTP data channel switched to Active mode, listening FTP server connect to '" + m_pSocket.LocalEndPoint.ToString() + "'.");
            }