部署好的ftp服務器,在客戶端A可以正常連接登錄,但是客戶端B無法連接和登錄。
登錄代碼是:
void FtpHelper::ConnectToFtp()
{
m_isPutting.store(false);
if (m_pFtp != NULL)
{
m_pFtp->close();
delete m_pFtp;
m_pFtp = NULL;
}
m_pFtp = new QFtp(this);
m_pFtp->connectToHost(m_serverIp, 21);
m_pFtp->login(m_userId, m_password);
//Qftp是異步的,只用能用槽來處理command完成后的操作
connect(m_pFtp, SIGNAL(commandFinished(int, bool)), this, SLOT(ftpCommandFinished(int, bool)));
connect(m_pFtp, SIGNAL(listInfo(const QUrlInfo &)), this, SLOT(ftpListInfo(const QUrlInfo &)));
connect(m_pFtp, SIGNAL(stateChanged(int)), this, SLOT(ftpStateChanged(int)));
vLogInfo("[ftp]start to connect and login ftp[%s]", m_serverIp.toLatin1().data());
}
用戶名密碼都是anonymous
客戶端B顯示的是日志是
00:01:06.890 [INFO] [00005250] [ftp]start to connect and login ftp[10.XXX]
00:01:07.062 [DEBUG] [00005250] [ftp][stateChanged][QFtp::HostLookup]
00:01:07.062 [DEBUG] [00005250] [ftp][stateChanged][QFtp::Connecting]
客戶端A顯示的日志是
17:04:27.998 [INFO] [00000634] [ftp]start to connect and login ftp[10.XXX]
17:04:28.076 [DEBUG] [00000634] [ftp][stateChanged][QFtp::HostLookup]
17:04:28.076 [DEBUG] [00000634] [ftp][stateChanged][QFtp::Connecting]
17:04:28.076 [DEBUG] [00000634] [ftp][stateChanged][QFtp::Connected]
17:04:28.076 [DEBUG] [00000634] [ftp][stateChanged][QFtp::LoggedIn]
17:04:28.076 [INFO] [00000634] [ftp][0]ftp connect success!
感覺是連接都沒連接上,但是在客戶端B上面直接用瀏覽器可以登錄的,這個可能是啥原因呢?
uj5u.com熱心網友回復:
但是客戶端B上面的C#寫的一個客戶端,也是可以訪問ftp呢,好奇怪的情況轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/284250.html
標籤:Qt
上一篇:基于Qt的軟體架構設計與性能優化
