[zeromq-dev] CZMQ and Server and Client Sockets

Andrew Simpson simpsonar77 at yahoo.com
Sat Aug 15 15:25:32 CEST 2015


I am currently using zmq_poll for all my polling needs.  I have to poll not only sockets but also things like serial/usb ports.  I am using czmq in a few other places, though.  I have just started looking at zloop though.  I need the fastest possible performance from the poller.  I'm currently modifying an application which explicitly used direct select statement calls. 


     On Saturday, August 15, 2015 3:48 AM, Doron Somech <somdoron at gmail.com> wrote:
   
 

 Andrew are you using CZMQ? which class do you use for multiple polling, zloop or zpoller?

On Fri, Aug 14, 2015 at 10:36 PM, Andrew Simpson <simpsonar77 at yahoo.com> wrote:

this sounds really excellent!  I am building an application that would greatly benefit from this over a standard Router/Dealer setup.  The only thing that will hold me back right now is the lack of polling on multiple client/server sockets.  I definitely need that.
Good stuff! 


     On Friday, August 14, 2015 9:09 AM, Doron Somech <somdoron at gmail.com> wrote:
   
 

 Hi All,
I added server and client sockets support to CZMQ, you can take a look at the change at the following pull request:
https://github.com/zeromq/czmq/pull/1059

Server socket is like router socket except you don't have an identity frame, each message also include routing id which is an int (vs byte array). So each message coming from a server socket include a routing id which can be retrieve by calling zframe_routing_id. When sending a message you must set the routing id by calling zframe_set_routing_id. You can use zframe_send_reply with both the destination frame and the source frame (which include the routing id), the method copy the routing id from the source frame to the destination frame and then send the message.
Client socket is same as dealer socket. Client and Server can only talk to each other.
Following is a small example on how to use the new client and server sockets:https://gist.github.com/somdoron/542b74922f652d229566

Client and server socket are thread safe (currently only support single frame messages but that might change, I think) so if your protocol is single frame you can use the server and client sockets from multiple threads.
Polling on multiple client or server sockets is not supported yet.
In the coming week I plan to also add zproto support and complete the polling on multiple sockets.
Doron

_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


 
   
_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev




_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


 
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150815/7be31472/attachment.htm>


More information about the zeromq-dev mailing list