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
| procedure TTcpClientToPACSThread.Execute();
var
InText: string;
OutArray: TStringDynArray;
ioa: Integer;
Work: TRISToPACSWork;
begin
SocketState := ssNone;
while not Terminated and FSocket.Connected do
begin
if PopWork(Work) then
begin
case Work.WorkType of
wtFile : Read...WorkListFile(Work.Data, OutArray);
wtMsg : begin
setLength(OutArray, 1);
OutArray[0] := Work.Data;
end;
end;
for ioa := Low(OutArray) to High(OutArray) do
begin
if OutArray[ioa] <> '' then
begin
SocketState := ssWriting;
try
FSocket.Sendln(OutArray[ioa], FEndOfLine);
TRISToPACS.WriteLog(FSocket.RemoteHost, FSocket.RemotePort, 'OUT', OutArray[ioa]);
finally
SocketState := ssNone;
end;
Sleep(1);
SocketState := ssReading;
try
InText := FSocket.Receiveln(FEndOfLine);
TRISToPACS.WriteLog(FSocket.RemoteHost, FSocket.RemotePort, 'IN', InText);
finally
SocketState := ssNone;
end;
Sleep(1);
SocketState := ssReconnecting;
try
FSocket.Disconnect(); // j'ai eu un soucis, cela vient du serveur qui me chasse après une lecture ...
FSocket.Connect();
finally
SocketState := ssNone;
end;
end;
end;
end;
Sleep(FBlockingTime);
end;
end; |
Partager