[fpc-devel] Re: Inter Process Communication

Jason P Sage jasonpsage at jegas.org
Thu Mar 1 01:11:55 CET 2007


I've just performed more tests using the stock simpleipc - and the
SendMessage and GetMessage - though defined as "STRING" (Which I thought had
a max length) seems to be able to support huge ansistrings.

This - implies that no changes are probably necessary. Though I'm a bit
perplexed about how I can make send an ansistring that is 1 megabyte through
a procedure/function pair - declared as only String - I hope this won't make
the application that may do this a bit "shaky" from writing to memory I
shouldn't be.

My test app is a modified version of the fcl demo/example ipcclient:
(The only new code is the declaration of the ansistring and the loop (and
i:integer var) to make it rather big - a kludge - but fine for proof of
concept testing. Note: I have my fpc configuration to only use 32 bit
integers and to allow the plus equal construct MyVari += 1; 

--- CODE BEGIN ----

{$mode objfpc}
{$h+}
program ipcclient;

uses simpleipc;
var sa: Ansistring;
   i: integer;
begin
  sa:='';
  for i:=1 to 100000 do sa+='1234567890';
  With TSimpleIPCClient.Create(Nil) do
    try
      ServerID:='ipcserver';
      If (ParamCount>0) then
        ServerInstance:=Paramstr(1);
      Active:=True;
      SendStringMessage(sa);
      Active:=False;
    finally
      Free;
    end;
end.

--- CODE END ----

This may be great news!
 
Jason P Sage




More information about the fpc-devel mailing list