private void Connect() { try { for (int i = 0; i < 3; i++) { m_ftp = new FTP(DatabaseModule.Instance.FtpServer); m_ftp.ConnectionTimeout = 150; //m_ftp = new FTP("192.168.20.83"); //m_ftp = new FTP("192.168.10.192"); //m_ftp.ResponseReceived += new FTPResponseHandler(m_ftp_ResponseReceived); //m_ftp.Connected += new FTPConnectedHandler(m_ftp_Connected); m_ftp.BeginConnect(DatabaseModule.Instance.FtpUsername, DatabaseModule.Instance.FtpPassword); //m_ftp.BeginConnect("username", ""); //m_ftp.BeginConnect("FTPAdmin", "P@ssw0rd"); if (m_ftp.IsConnected) { break; } } if (!m_ftp.IsConnected) { throw new FTPException("Cant connect to ftp server"); } } catch (FTPException ex) { throw new FTPException("Cant connect to ftp server"); //throw new FTPException("Cant connect to ftp server" + "\r\n" + "Exception : " + ex.Message); } }