可以设置timeout属性呀!
roperty TimeOut: Integer;Description
The TimeOut property specifies the amount of time (in milliseconds) to wait for a response from the socket before an exception is raised and the current operation is aborted. If TimeOut is 0, an exception is never raised, and operations never time out.
...
NMSMTP1.Timeout := 5000; //这样如果5s内没连上的话就出异常,在OnConnectionFailed中处理
NMSMTP1.Connect;
...
roperty TimeOut: Integer;Description
The TimeOut property specifies the amount of time (in milliseconds) to wait for a response from the socket before an exception is raised and the current operation is aborted. If TimeOut is 0, an exception is never raised, and operations never time out.
...
NMSMTP1.Timeout := 5000; //这样如果5s内没连上的话就出异常,在OnConnectionFailed中处理
NMSMTP1.Connect;
...
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货