开发者

How to delphi send and receive command c-echo, c-get dicom communication pacs or modality

How do I get the message from any pacs server Delphi and display this message ASCII format in memo1

is it possible to use could this indy component.

This is an example code from http://sourceforge.net/projects/indy10clieservr/

Send C-ECHO Command from any Modality Emulator or Any PACS Server. Connected Ok but cant see incoming message in memo1. But Chamelon HL7 component display to message on Delphi

procedure TServerMainForm.IdTCPServerConnect(AContext: TIdContext);
begin
     memo1.Lines.Add('Connection from ..PeerIP/IP' + AContext.Binding.PeerIP  + '  // '  +    AContext.Binding.IP  + '  @ ' + dateToStr(now) + '->' +  TimeToStr(now)  );
     AContext.Connection.IOHandler.WriteLn('C-ECHO-RSP');
end;

procedure TServerMainForm.IdTCPServerExecute(AContext: TIdContext);
var    CommBlock, NewCommBlock   :    TINDYCMD;
       buf                       :    TIdBytes;
       line                      :    String;
       i                         :    integer;

begin

   memo1.Lines.Add('server execute start' );


   with  AContext.Connection  do
         begin
            IOHandler.Readln(line);
         end;
   try 
    ////////////// This line = 0 and cant see anything memo1. ////////////
    if length(line) > 0  then
        begin
        memo1.Lines.Add(line );
        i:= strToInt(Line);
        end
        else
        i:=-1;
   except

  end;


   case i of
    0:  begin
          TCPServerExecuteExchangeStrings(AContext);
        end;
    1 : begin

         TCPServerExecuteExchangeRecords(AContext);

        end;
    2:  begin
        end;
    else
       //
    end;

   LEDShape.brush.Color :开发者_如何学运维= clgreen;
   memo1.Lines.Add('server execute done' );

end;


I don't quite understand the question... But I did quickly see a problem:

Any Internet Server needs to be validate input. Not doing so is a security risk.

In this case you are expecting to be sent a valid integer. If you don't get a valid integer you raise an exception. This may be desired behavior but I doubt it.

specifically this line: i:= strToInt(Line);

Instead you might try..

if TryStrToInt(line,i) then
  // Handle valid integer sent
else
  // Handle Invalid integer sent
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜