1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61:
| function TtoIFComThread.ConnectToComSvr: Boolean; begin Result := TRUE; try if (not F_toTCPIPIFClient.Connected) and ((GetTickCount-F_cardLastTry) > IF_CONST_MAXWAITFORREPLY) then begin LogEvent(g_astrIFComBase[29], 'TtoIFComThread.ConnectToComSvr', etInfo, IF_CONST_LOGLEVEL_MAX);
F_cardLastTry := GetTickCount;
if (F_strComSvrIP <> EmptyStr) and (F_iComSvrPort > IF_CONST_NODATA_INT) then begin F_toTCPIPIFClient.Host := F_strComSvrIP; F_toTCPIPIFClient.Port := F_iComSvrPort;
try F_toTCPIPIFClient.Connect(IF_CONST_WAITFORCONNECT); except on excError: Exception do begin LogEvent((Format(g_astrIFComErrors[0], [F_toTCPIPIFClient.Host, F_toTCPIPIFClient.Port]) + ' ' + excError.Message), 'TtoIFComThread.ConnectToComSvr', etError, IF_CONST_LOGLEVEL_MIN); Result := FALSE; Exit; end; end; end else begin LogEvent(Format(g_astrIFComErrors[9], [F_strComSvrIP, F_iComSvrPort]), 'TtoIFComThread.ConnectToComSvr', etError, IF_CONST_LOGLEVEL_MIN); Result :=FALSE; end;
LogEvent(g_astrIFComBase[30], 'TtoIFComThread.ConnectToComSvr', etInfo, IF_CONST_LOGLEVEL_MAX); end; except on excError: Exception do begin LogEvent((Format(g_astrIFComErrors[0], [F_toTCPIPIFClient.Host, F_toTCPIPIFClient.Port]) + ' ' + excError.Message), 'TtoIFComThread.ConnectToComSvr', etError, IF_CONST_LOGLEVEL_MIN); Result := FALSE; end; end; end; |