[zeromq-dev] java server (DEALER) + worker / c client (REQ)

Davis Ford davisford at gmail.com
Thu Sep 27 18:42:10 CEST 2012


Ah - brilliant.  That fixes it - thanks!

One follow up question, if I try to change the semantics so the client
sends asynchronously, it doesn't seem to work.

In the round-trip example http://zguide.zeromq.org/c:tripping - they do a
loop with both synch and async sending.

If I try the same, the synch req/rep works, but the async does not.  Here's
my async function.

void comm_send_asynch(int cnt, bool debug) {
  printf("Asynchronous round-trip test...\n");
  int requests;
  int64_t start = zclock_time();

  for (requests = 0; requests < cnt; requests++) {

    int ret = zstr_send(client, "Hello");
    if (ret != 0) {
      if (debug) { dumpError("zstr_send", 115); }
    }
  }

  for (requests = 0; requests < cnt; requests++) {
    char *reply = zstr_recv (client);
    if (debug) { printf ("\n\treceived: %s\n", reply); }
    free (reply);
  }
  printf("\n\t%d calls/second\n",
    (1000 * cnt) / (int) (zclock_time() - start));
}

When it gets to the async loop, the program outputs:

Asynchronous round-trip test...
zmq error: : Unknown error: 156384763
zstr_send (line 115) returned errno Unknown error: 156384763

I seem to receive the first reply from the server, but (null) thereafter.


received: Hello

received: (null)

..and finally this:

Floating point exception: 8

Any idea what is wrong with the async req/reply ?

On Thu, Sep 27, 2012 at 12:20 PM, Michel Pelletier <
pelletier.michel at gmail.com> wrote:

> You need to set the identify before the connect, as you did in the Java
> version.
>
> -Michel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120927/e2f520f4/attachment.html>


More information about the zeromq-dev mailing list