J
jieson
Unregistered / Unconfirmed
GUEST, unregistred user!
代码如下
NMUDPMain.RemoteHost := ServerIP;
NMUDPMain.ReportLevel := Status_Basic;
NMUDPMain.LocalPort := 4567;
NMUDPMain.RemotePort := 5678;
ConnectWay := 'UDP方式' ;
bindingnumber := 2342;
SendToStream:=tmemorystream.Create ;
try
SendToStream.Write(MainForm.buff[1],length(MainForm.buff));
MainForm.NMUDPMain.SendStream(SendToStream);
finally
SendToStream.free;
end;
症状:
当serverip错误,或者serverip上5678端口没开,或者serverip不存在,总之是程序连不上服务器的话,
程序就会出错,错误提示如下:
Project Project1.exe raised exception class UDPSockError with message 'Host Lookup Canceled'
Process stopped.Use Step or Run to continue.
错误的原因很明显,只是我想捕捉到这个错误,应该怎么做?
NMUDPMain.RemoteHost := ServerIP;
NMUDPMain.ReportLevel := Status_Basic;
NMUDPMain.LocalPort := 4567;
NMUDPMain.RemotePort := 5678;
ConnectWay := 'UDP方式' ;
bindingnumber := 2342;
SendToStream:=tmemorystream.Create ;
try
SendToStream.Write(MainForm.buff[1],length(MainForm.buff));
MainForm.NMUDPMain.SendStream(SendToStream);
finally
SendToStream.free;
end;
症状:
当serverip错误,或者serverip上5678端口没开,或者serverip不存在,总之是程序连不上服务器的话,
程序就会出错,错误提示如下:
Project Project1.exe raised exception class UDPSockError with message 'Host Lookup Canceled'
Process stopped.Use Step or Run to continue.
错误的原因很明显,只是我想捕捉到这个错误,应该怎么做?