Anyone has experience using sockets for inter-process communication using Delphi on OSX?

Comments

  1. The Synopse mORMot has a hidden gem - Interfaced-based inter-process and/or inter-machine communication, over Sockets, named pipe or Windows message. it's much better than rolling your own using named pipe or socket streams.

    Step 1: you define the interface to share between the client and servers:
    type
      ICalculator = interface(IInvokable)
        ['{9A60C8ED-CEB2-4E09-87D4-4A16F496E5FE}']
        function Add(n1,n2: integer): integer;
      end;

    Step 2: You implement the interface on the server side, let it's TServiceCalculator.

    Step 3: You register it with the mORMot server:
    myServer.ServiceRegister(TServiceCalculator, TypeInfo(ICalculator)],sicShared);

    Step4: it's now ready to be consumed by the client:
      declare on the client side: myClient.ServiceDefine([ICalculator],sicShared);
     
      Use:
    var I: ICalculator;
    begin
      I := Client.Service;
      if I<>nil then
        result := I.Add(10,20);
    end;

    Yes, it's like COM, but much simple, lightweight and easy! 
    PS, you don't have to include the SQLITE3 engine if IPC is all you need. consult the docs for details: http://synopse.info/files/html/Synopse%20mORMot%20Framework%20SAD%201.18.html#TITLE_352

    ReplyDelete
  2. Edwin Yip The app I am communicating with (on OSX) is not written in Delphi. How does this work for that?

    ReplyDelete
  3. James Foster Oops! Sorry, I somehow did not read the " OS X".  IIRC mORmot, the server part, doesn't work on Mac OS X yet,.

    ReplyDelete

Post a Comment