[Lazarus] ZeroMQ Bindings

Leonardo M. Ramé l.rame at griensu.com
Tue Aug 23 02:56:18 CEST 2016


Hi, I need to use ZeroMQ for inter process communication, but the 
bindings at https://github.com/bvarga/delphizmq does not seems to work, 
at least on Linux (XUbuntu 16.04 64bits) and zmq 4.2.

The client is an C++ app and the server is the FPC/Lazarus one. Before 
trying with Lazarus I did this very simple Python program and it worked:

     import zmq

     context = zmq.Context()
     socket = context.socket(zmq.REP)
     socket.bind("ipc://localscp")

     while True:
         #  Wait for next request from client
         message = socket.recv()
         print "Received request: ", message
        socket.send("AA")

The port to FPC/Lazarus should be this:

     var
       context: pointer;
       responder: pointer;
       buf: array[0..9] of char;
     begin
       context := zmq_ctx_new;
       responder := zmq_socket(context, ZMQ_REP);
       zmq_bind(responder, 'ipc:///localscp');

       while true do
       begin
         zmq_recv(responder, buf, 10, 0); // here hangs
         writeln(buf);
       end;
     end;

Any hint?

-- 
Leonardo M. Ramé
Medical IT - Griensu S.A.
Av. Colón 636 - Piso 8 Of. A
X5000EPT -- Córdoba
Tel.: +54(351)4246924 +54(351)4247788 +54(351)4247979 int. 19
Cel.: +54 9 (011) 40871877


More information about the Lazarus mailing list