Fast Inter Machine Communication for Delphi based on Named Pipes. Main features are:

  • Fast inter machine comunication channel
  • Packet oriented messaging.
  • Hides technical implementation from user
  • Client/Server approach. Multiple clients, thread safe…
  • Multithreaded server using thread pool
  • Data packets are versatile data carriers
Cromis IMC download: Version 1.3.0 (23.04.2013)

To demo bellow shows the basic usage of Cromis IMC communication for Delphi. The first sample is for client side and the second for server side. If you have trouble using the code or have any other questions, please contact me directly using the “Contact” page or write a comment bellow the page.

Client side:

procedure TfMain.btnSendClick(Sender: TObject);
var
  Result: IIMCData;
  Request: IIMCData;
  IMCClient: TIMCClient;
  TimeStamp: TDateTime;
begin
  IMCClient := TIMCClient.Create;
  try
    IMCClient.ServerAddress := eServerAddress.Text;
    IMCClient.ConnectClient;
    try
      if IMCClient.IsConnected then
      begin
        Request := AcquireIMCData;
        Request.ID := DateTimeToStr(Now);
        Request.Data.WriteUTF8String('Command', 'Synchronous');
        Result := IMCClient.ExecuteConnectedRequest(Request);
 
        if IMCClient.AnswerValid then
        begin
          TimeStamp := Result.Data.ReadDateTime('TDateTime');
          ListBox1.Items.Add(Format('Synchronous Response with ID: %s', [Result.ID]));
          ListBox1.Items.Add(Format('Response: TDateTime [%s]', [DateTimeToStr(TimeStamp)]));
          ListBox1.Items.Add(Format('Response: Integer [%d]', [Result.Data.ReadInteger('Integer')]));
          ListBox1.Items.Add(Format('Response: Real [%f]', [Result.Data.ReadReal('Real')]));
          ListBox1.Items.Add(Format('Response: String [%s]', [Result.Data.ReadUTF8String('String')]));
          ListBox1.Items.Add('-----------------------------------------------------------');
        end;
      end;
 
      if IMCClient.LastError <> 0 then
        ListBox1.Items.Add(Format('Error: Code %d', [IMCClient.LastError]));
    finally
      IMCClient.DisconnectClient;
    end;
  finally
    IMCClient.Free;
  end;
end;

Server side:

procedure TfMain.OnExecuteRequest(const Request, Response: IIMCData);
var
  Command: AnsiString;
begin
  Command := Request.Data.ReadUTF8String('Command');
  ListBox1.Items.Add(Format('%s Request Recieved (Sent at: %s)', [Command, Request.ID]));
  Inc(FRequestCount);
 
  Response.ID := Format('Response nr. %d', [FRequestCount]);
  Response.Data.WriteDateTime('TDateTime', Now);
  Response.Data.WriteInteger('Integer', 5);
  Response.Data.WriteReal('Real', 5.33);
  Response.Data.WriteUTF8String('String', 'to je testni string');
  Caption := Format('%d requests processed', [FRequestCount]);
end;

Change Log

  • 1.3.0
    • Greatly improved speed by using buffering and eliminating some waits
    • Better handling of internal server errors when executing requests
  • 1.2.0
    • Made INDY9 and BDS 2006 upward compatible
  • 1.1.3
    • Added IsConnected property
  • 1.1.2
    • Same code syntax as in IPC
  • 1.1.1
    • Code optimizations
    • Execute timeout for server
    • ErroDesc for client
  • 1.1.0
    • Optimized the code for speed
    • Restructured some of the code and some of the procedures and properties
    • Added execute timeouts, to both server and client
  • 1.0.2
    • Initial implementation