-1

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;
cvg
  • 31
  • 1
  • 7
  • It's very hard to understand what you need because of the spelling and grammar errors. You may try using [Google Translate](http://translate.google.com/) to get some english text from your native language. You might also want to include some source code with your message: There's a hint of a runtime error (EConversion error), maybe we can figure something out from the code. – Cosmin Prund Mar 09 '11 at 14:21

1 Answers1

0

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
Robert Love
  • 12,447
  • 2
  • 48
  • 80