Update:

I miraculously figured out how to use ZMQ in Julia, i.e. you type "using 
ZMQ" :)

More seriously, I managed to get jeromq working in Eclipse and started 
trying to get it to talk to Julia's ZMQ. I was trying to follow the 
examples in the zguide (which is awesome btw):

   - http://zguide.zeromq.org/page:all
   
But had some difficulties. For example, it is not totally obvious how to 
implement the "Hello World" server in Julia. Here is the C version:

#include <zmq.h>

#include <stdio.h>

#include <unistd.h>

#include <string.h>

#include <assert.h>

int main (void)

{

*// Socket to talk to clients*

void *context = zmq_ctx_new ();

void *responder = zmq_socket (context, ZMQ_REP);

int rc = zmq_bind (responder, "tcp://*:5555");

assert (rc == 0);

*while* (1) {

char buffer [10];

zmq_recv (responder, buffer, 10, 0);

printf ("Received Hello*\n*");

sleep (1); *// Do some 'work'*

zmq_send (responder, "World", 5, 0);

}

*return* 0;

}

I got this far:

*julia> **using ZMQ*

*julia> **ctx = Context(1)*

*Context(Ptr{Void} @0x00007fc8a25b8d60,[])*

*julia> **s = Socket(ctx, REP)*

*Socket(Ptr{Void} @0x00007fc8a7ce2600)*
*julia> **ZMQ.bind(s, "tcp://*:5555")* 


This all seems to work. But I don't know how to implement the while loop 
properly. Any hints?

Best regards,
Eric

Reply via email to