當我設置ConnectTimeout在IdSMTP(例如30秒),並且SMTP服務器不可用時,它從SMTP服務器105秒德爾福,安卓,SSL - IdSMTP ConnectTimeout - 預設超時後不會終止連接到服務器
這是版本10中的Indy組件 - * 250.bpl,OpenSSL v1.0.2。
使用IdFTP ConnectTimeout可以毫無問題地工作。
哪裏可能有bug?
...
IdOpenSSLSetLibPath(FDocumentsPath);
SSLHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
SMTP:= TIdSMTP.Create(nil);
MSG:= TIdMessage.Create(nil);
try
SSLHandler.SSLOptions.Method:= sslvSSLv23;
SSLHandler.SSLOptions.Mode := sslmClient;
SMTP.IOHandler := SSLHandler;
SMTP.UseTLS:= utUseImplicitTLS;
SMTP.AuthType:= satDefault;
SMTP.Port:= 465;
SMTP.Host:= xxx.xxx.xxx.xxx;
SMTP.Username:= xxxxx;
SMTP.Password:= xxxxx;
SMTP.ConnectTimeout:= 30000;
SMTP.ReadTimeout:= 30000;
try
SMTP.Connect;
except
end;
...
finally
SMTP.Disconnect;
UnLoadOpenSSLLibrary;
FreeAndNil(MSG);
FreeAndNil(SSLHandler);
FreeAndNil(SMTP);
end;
很好解釋。感謝雷米 – KJAN