OK, thanks, so I have to call recv immediately every time I call send? That makes it a bit difficult to reconcile with my other codepaths (which are all handlers coming off of a select statement)
On 12/8/2011 1:33 PM, Francois-Xavier Bourlet wrote: > Hi, > > The keyword is: edge-triggered. > > You need to wait only if you can't read anything from the socket > anymore. To do so, always read using NOBLOCK, and in the case you get > a TRYAGAIN error, then you wait via your select/ioloop whatever. > > Regards, > > On Thu, Dec 8, 2011 at 7:59 AM, Yi Ding <[email protected]> wrote: >> Hi everyone, >> >> New Zeromq user here. Please bear with me if the answer to this >> question is blindingly obvious. >> >> I'm trying to use zeromq with select/epoll so that I can have a single >> thread multiplex between different inputs. After reading the >> documentation on ZMQ_FD, I found that it works for ZMQ_REP sockets but >> not for ZMQ_REQ sockets. >> >> I've basically modified the hello world server and client (the waitForIt >> function is the same in both files): >> >> Server code: http://pastebin.com/eBNaSVYC >> Client code: http://pastebin.com/ivt1xfa0 >> >> What happens is that the server (ZMQ_REP) gets the request and sends a >> reply, but the client (ZMQ_REQ) never gets signaled for the reply, so >> the select times out. >> >> If we change the client to not use select, or use the default client, >> everything works fine. >> Working client code: http://pastebin.com/sg5QyZC2 >> >> Reading through the list, I also tried changing the client from ZMQ_REQ >> to ZMQ_DEALER, but that didn't work either. >> >> Does anyone know why the file descriptor for ZMQ_REP gets triggered but >> the file descriptor for ZMQ_REQ does not? Is this a bug, or am I doing >> something wrong? >> >> I'm running ZeroMQ 2.1.10 on Linux with GCC 4.4. >> >> Thanks in advance, >> Yi >> _______________________________________________ >> zeromq-dev mailing list >> [email protected] >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev > > _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
