[zeromq-dev] czmq container serialization
Hi all, As part of an application I am developing I need to serialize/unserialize a zlistx_t and a zhash_t into/from messages. In my particular use case, the elements stored in these containers belong to a custom czmq-style C class with its own my_class_new/my_class_destroy. When I first read the zhashx API I initially thought I could use zhashx_pack/zhashx_unpack (at least for the zhashx), but I soon realized this doesn't (and can't) work for custom types. The solution I adopted required the following changes: Implemented the following functions for the custom class: // return the size of self in bytes size_t my_class_size(my_class_t *self); // serialize the contents of self into buf. // the space used may not exceed my_class_size(self) void my_class_store(my_class_t *self, void *buf); // unserialize the contents of buf into a new my_class_t instance. my_class_t *myclass_load(void *buf); The behavior of myclass_store and myclass_load is such that the following is a valid implementation of myclass_dup: my_class_t *myclass_dup(myclass_t *self) { void *buf = zmalloc(my_class_size(self)); myclass_store(self, buf); myclass_t *other = myclass_load(buf); free(buf); return other; } I also implemented the following methods for the container functions: typedef size_t (size_func_t)(void *); typedef void (store_func_t)(void *, void *); typedef void *(load_func_t)(void *); size_t zlistx_size(zlistx_t *self, size_func_t size_func); void zlistx_store(zlistx_t *self, void *buf, size_func_t size_func, store_func_t store_func); zlistx_t *zlistx_load(void *buf, size_func_t size_func, load_func_t load_func); size_t zhashx_size(zhashx_t *self, size_func_t size_func); void zhashx_store(zhashx_t *self, void *buf, size_func_t size_func, store_func_t store_func); zhashx_t *zhashx_load(void *buf, size_func_t size_func, load_func_t load_func); You will notice the load and store function signatures for zlistx and zhashx are different than for my_class, this is to accomodate for the fact that these are containers and therefore must also be able to load and store their elements. Using the above methods its quite trivial to serialze and unserialize lists and hashes into zframes for sending messages or into binary files for long term storage. The same container serailization methods can be used regardless of the type of elements they store, as long as they implement the required load/store/size API for these elements. Although the above works, I wanted to ask experienced czqm developers if there is a more elegant way to implement container serialization/unserialization in czmq. Also, I would be surprised to find that I am the first czmq user that needs to serialize custom containers into messages. Is there a reason something like this is not already included in czmq's core? Should I polish and document this and submit a pull-request, or does this seem like a very uncommon use of containers in the czmq world? Alex ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] Alternative efficiency design of lbbroker
No, I don't want dealer router combination. Basically I have two mutually requiring parties that are each doing a lot of processing and work, distributed over a lot of machines. They all run concurrently, so there has to be a reliable way to facilitate an exchange of a work task from a producer to one that is ready to receive, but sometimes the workers also need to send messages back to the work producer to inform them of something. So what I've done is I've made the lb broker example, only except currently I've got it modified so that it: 1) facilitates a pairing 2) ferries message from *each* side to the other Currently, the manual offers work-work producer example with lb broker that facilitates an exchange first and then ferries a message from the work producer to the worker. So it's just a little bit different. So the way I understand it is, the load balancing broker in the example is somewhat of a bottle neck. What I was thinking though is, instead of receiving the opposite side's address on each side like I do in order that I can send that *back through the broker to be routed to the other side*, why not immediately use the address in order to make a send on a local router socket send to the correct destination on the side of the worker. In this way, the broker actually facilitates connection setup (no sock->connect, just direct relation pairing). In the previous example, if this works then individual 1 & 2 first talk to broker to find out what they need to know in order to talk directly to one another. So this is better use of resources; if there are lots of data being sent back and forth through the broker the manual example, you could potentially add too many workers and work producers on each side; then workers starve (somewhat) and managers await them (somewhat). What I didn't know was, if you have the address on each side first, and you have a router object in the worker/work producer, and you take the address received from the opposite side of the broker and empty delimit it on the local router socket in order for it to go directly to individual 1/2, will that work in zmq? On Mon, Jan 12, 2015 at 10:28 AM, Benjamin wrote: > >> But I want to do simply a request to the broker and receive the > information I need in order to send directly to the other entity. > > I don't follow the question. You're talking about name-resolution? > Chain of servers is how DNS works for instance (router => X => > router). Some server knows the answer to a lookup, so one node can > request information from a second node, which the client did not know > about. Perhaps you're looking for some dealer/router combination > described in the ZMQ guide. > > On Mon, Jan 12, 2015 at 4:09 PM, Pieter Hintjens wrote: > > No apologies, I wasn't aiming to be critical. It's just that the > > thinking process happens best by making working code and then > > improving it. If you have specific questions others can help. With > > larger architectural questions, you won't often get answers here. > > > > On Mon, Jan 12, 2015 at 3:43 PM, Kenneth Adam Miller > > wrote: > >> Oh I apologize. I was just asking if what I was thinking of was possible > >> with zeromq. > >> > >> On Mon, Jan 12, 2015 at 4:29 AM, Pieter Hintjens wrote: > >>> > >>> > In any case, does what I am thinking about work? > >>> > >>> It's usually a good idea to make small pieces, and grow your > >>> understanding of your problem and alternative solutions like that. > >>> No-one here can do that for you. > >>> > >>> On Mon, Jan 12, 2015 at 7:31 AM, Kenneth Adam Miller > >>> wrote: > >>> > Instead of routing all information through the broker and requiring > an > >>> > intermediary hop, I'd like to consider an approach where the address > >>> > information that the req socket parses out on the side that first > sends > >>> > ready is used in order to manage a simple mutual connection > facilitator > >>> > in > >>> > ZMQ... > >>> > > >>> > Just like with load balancing broker from the manual, I have two > parties > >>> > that mutually require one another. But I want to do simply a request > to > >>> > the > >>> > broker and receive the information I need in order to send directly > to > >>> > the > >>> > other entity. > >>> > > >>> > With router sockets, I get the address in a empty delimited set of > >>> > message > >>> > sending convention. What I don't know is if I add a router socket to > >>> > each > >>> > mutually requiring party, and -even if party A is not connected even > to > >>> > party B- use the address information attained from the broker to > send on > >>> > party A's router socket to party B and vice versa. Is this the best > way > >>> > to > >>> > do this? I don't want to manage a set of connected sockets. > >>> > > >>> > I realize that party A may have individual 1 and party B an > individual 2 > >>> > where 1 & 2 repeatedly make connection over broker-I want to keep > using > >>> > broker anyway, because broker allows each party to know when
Re: [zeromq-dev] Alternative efficiency design of lbbroker
>> But I want to do simply a request to the broker and receive the information >> I need in order to send directly to the other entity. I don't follow the question. You're talking about name-resolution? Chain of servers is how DNS works for instance (router => X => router). Some server knows the answer to a lookup, so one node can request information from a second node, which the client did not know about. Perhaps you're looking for some dealer/router combination described in the ZMQ guide. On Mon, Jan 12, 2015 at 4:09 PM, Pieter Hintjens wrote: > No apologies, I wasn't aiming to be critical. It's just that the > thinking process happens best by making working code and then > improving it. If you have specific questions others can help. With > larger architectural questions, you won't often get answers here. > > On Mon, Jan 12, 2015 at 3:43 PM, Kenneth Adam Miller > wrote: >> Oh I apologize. I was just asking if what I was thinking of was possible >> with zeromq. >> >> On Mon, Jan 12, 2015 at 4:29 AM, Pieter Hintjens wrote: >>> >>> > In any case, does what I am thinking about work? >>> >>> It's usually a good idea to make small pieces, and grow your >>> understanding of your problem and alternative solutions like that. >>> No-one here can do that for you. >>> >>> On Mon, Jan 12, 2015 at 7:31 AM, Kenneth Adam Miller >>> wrote: >>> > Instead of routing all information through the broker and requiring an >>> > intermediary hop, I'd like to consider an approach where the address >>> > information that the req socket parses out on the side that first sends >>> > ready is used in order to manage a simple mutual connection facilitator >>> > in >>> > ZMQ... >>> > >>> > Just like with load balancing broker from the manual, I have two parties >>> > that mutually require one another. But I want to do simply a request to >>> > the >>> > broker and receive the information I need in order to send directly to >>> > the >>> > other entity. >>> > >>> > With router sockets, I get the address in a empty delimited set of >>> > message >>> > sending convention. What I don't know is if I add a router socket to >>> > each >>> > mutually requiring party, and -even if party A is not connected even to >>> > party B- use the address information attained from the broker to send on >>> > party A's router socket to party B and vice versa. Is this the best way >>> > to >>> > do this? I don't want to manage a set of connected sockets. >>> > >>> > I realize that party A may have individual 1 and party B an individual 2 >>> > where 1 & 2 repeatedly make connection over broker-I want to keep using >>> > broker anyway, because broker allows each party to know when an >>> > individual >>> > is ready in each. So the 1& 2 scenario is coincidental. >>> > >>> > But what I don't think is a good design idea is having a socket that >>> > makes >>> > connect/close calls between each iteration to the broker or the idea of >>> > having each endpoint know it's hostname or something (possibly I have >>> > premature misgivings). >>> > >>> > In any case, does what I am thinking about work? Reading the target >>> > address >>> > information gained from a router object and feeding it to a completely >>> > different router object (where individual 1 may not have ever had his >>> > router >>> > connected to individual 2 before)? >>> > >>> > ___ >>> > zeromq-dev mailing list >>> > zeromq-dev@lists.zeromq.org >>> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev >>> > >>> ___ >>> zeromq-dev mailing list >>> zeromq-dev@lists.zeromq.org >>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev >> >> >> >> ___ >> zeromq-dev mailing list >> zeromq-dev@lists.zeromq.org >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev >> > ___ > zeromq-dev mailing list > zeromq-dev@lists.zeromq.org > http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] Alternative efficiency design of lbbroker
No apologies, I wasn't aiming to be critical. It's just that the thinking process happens best by making working code and then improving it. If you have specific questions others can help. With larger architectural questions, you won't often get answers here. On Mon, Jan 12, 2015 at 3:43 PM, Kenneth Adam Miller wrote: > Oh I apologize. I was just asking if what I was thinking of was possible > with zeromq. > > On Mon, Jan 12, 2015 at 4:29 AM, Pieter Hintjens wrote: >> >> > In any case, does what I am thinking about work? >> >> It's usually a good idea to make small pieces, and grow your >> understanding of your problem and alternative solutions like that. >> No-one here can do that for you. >> >> On Mon, Jan 12, 2015 at 7:31 AM, Kenneth Adam Miller >> wrote: >> > Instead of routing all information through the broker and requiring an >> > intermediary hop, I'd like to consider an approach where the address >> > information that the req socket parses out on the side that first sends >> > ready is used in order to manage a simple mutual connection facilitator >> > in >> > ZMQ... >> > >> > Just like with load balancing broker from the manual, I have two parties >> > that mutually require one another. But I want to do simply a request to >> > the >> > broker and receive the information I need in order to send directly to >> > the >> > other entity. >> > >> > With router sockets, I get the address in a empty delimited set of >> > message >> > sending convention. What I don't know is if I add a router socket to >> > each >> > mutually requiring party, and -even if party A is not connected even to >> > party B- use the address information attained from the broker to send on >> > party A's router socket to party B and vice versa. Is this the best way >> > to >> > do this? I don't want to manage a set of connected sockets. >> > >> > I realize that party A may have individual 1 and party B an individual 2 >> > where 1 & 2 repeatedly make connection over broker-I want to keep using >> > broker anyway, because broker allows each party to know when an >> > individual >> > is ready in each. So the 1& 2 scenario is coincidental. >> > >> > But what I don't think is a good design idea is having a socket that >> > makes >> > connect/close calls between each iteration to the broker or the idea of >> > having each endpoint know it's hostname or something (possibly I have >> > premature misgivings). >> > >> > In any case, does what I am thinking about work? Reading the target >> > address >> > information gained from a router object and feeding it to a completely >> > different router object (where individual 1 may not have ever had his >> > router >> > connected to individual 2 before)? >> > >> > ___ >> > zeromq-dev mailing list >> > zeromq-dev@lists.zeromq.org >> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev >> > >> ___ >> zeromq-dev mailing list >> zeromq-dev@lists.zeromq.org >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev > > > > ___ > zeromq-dev mailing list > zeromq-dev@lists.zeromq.org > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] Alternative efficiency design of lbbroker
Oh I apologize. I was just asking if what I was thinking of was possible with zeromq. On Mon, Jan 12, 2015 at 4:29 AM, Pieter Hintjens wrote: > > In any case, does what I am thinking about work? > > It's usually a good idea to make small pieces, and grow your > understanding of your problem and alternative solutions like that. > No-one here can do that for you. > > On Mon, Jan 12, 2015 at 7:31 AM, Kenneth Adam Miller > wrote: > > Instead of routing all information through the broker and requiring an > > intermediary hop, I'd like to consider an approach where the address > > information that the req socket parses out on the side that first sends > > ready is used in order to manage a simple mutual connection facilitator > in > > ZMQ... > > > > Just like with load balancing broker from the manual, I have two parties > > that mutually require one another. But I want to do simply a request to > the > > broker and receive the information I need in order to send directly to > the > > other entity. > > > > With router sockets, I get the address in a empty delimited set of > message > > sending convention. What I don't know is if I add a router socket to each > > mutually requiring party, and -even if party A is not connected even to > > party B- use the address information attained from the broker to send on > > party A's router socket to party B and vice versa. Is this the best way > to > > do this? I don't want to manage a set of connected sockets. > > > > I realize that party A may have individual 1 and party B an individual 2 > > where 1 & 2 repeatedly make connection over broker-I want to keep using > > broker anyway, because broker allows each party to know when an > individual > > is ready in each. So the 1& 2 scenario is coincidental. > > > > But what I don't think is a good design idea is having a socket that > makes > > connect/close calls between each iteration to the broker or the idea of > > having each endpoint know it's hostname or something (possibly I have > > premature misgivings). > > > > In any case, does what I am thinking about work? Reading the target > address > > information gained from a router object and feeding it to a completely > > different router object (where individual 1 may not have ever had his > router > > connected to individual 2 before)? > > > > ___ > > zeromq-dev mailing list > > zeromq-dev@lists.zeromq.org > > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > > > ___ > zeromq-dev mailing list > zeromq-dev@lists.zeromq.org > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] Message queuing broker for mobile device
You must set these before doing a bind or connect. On Mon, Jan 12, 2015 at 11:07 AM, Gang Liu wrote: > I already tried this way(set > ZMQ_TCP_KEEPALIVE/ZMQ_TCP_KEEPALIVE_CNT/ZMQ_TCP_KEEPALIVE_IDLE/ZMQ_TCP_KEEPALIVE_INTVL > at broker front end zsock), it seems these setting don't apply to new > incoming connection. I will try again. > > regards, > Gang > > On Mon, Jan 12, 2015 at 5:57 PM, Pieter Hintjens wrote: >> You can change the TCP socket keep alive setting, yes. See >> http://api.zeromq.org/4-2:zmq-setsockopt#toc42 >> >> On Mon, Jan 12, 2015 at 10:43 AM, Gang Liu wrote: >>> After some tracing, I found this case could be repeated when client >>> socket in connected state and I power off Wi-Fi router >>> or turn off mobile device 3G DATA signal before zmq client do disconnect. >>> >>> Is there any way to enable broker's low level client TCP sockets >>> KEEP_ALIVE option? I try to setopt at broker front end zsock, >>> but don't help much. Yes, I am still thinking in BSD socket way. or do >>> I need chose another zeromq pattern to handle clients no reliable inet >>> connection? >>> >>> thanks for your kindly. >>> >>> regards, >>> Gang >>> >>> >>> >>> On Mon, Jan 12, 2015 at 5:30 PM, Pieter Hintjens wrote: These sockets are managed automatically by TCP. On Mon, Jan 12, 2015 at 7:41 AM, Gang Liu wrote: > Dear all, > I am new to zeromq. I have a question about message > queuing broker (msgqueue.c) which use zmq_proxy() forward msgs between > frontend and backend. > In my testing code, the mobile client is using ZMQ_DEALER > socket to connect to this broker. But after some time, I found there > are more and more connected TCP at broker server side, all in > ESTABLISHED state. I am sure there are no more than ten clients and > even all apps in closed state. > Because there are no way to get low level TCP sockets of > broker, so is there any way to clean those "DEAD" TCP connections when > clients at WI-FI or 3G env? > > regards, > Gang > ___ > zeromq-dev mailing list > zeromq-dev@lists.zeromq.org > http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev >>> ___ >>> zeromq-dev mailing list >>> zeromq-dev@lists.zeromq.org >>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev >> ___ >> zeromq-dev mailing list >> zeromq-dev@lists.zeromq.org >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev > ___ > zeromq-dev mailing list > zeromq-dev@lists.zeromq.org > http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] Message queuing broker for mobile device
I already tried this way(set ZMQ_TCP_KEEPALIVE/ZMQ_TCP_KEEPALIVE_CNT/ZMQ_TCP_KEEPALIVE_IDLE/ZMQ_TCP_KEEPALIVE_INTVL at broker front end zsock), it seems these setting don't apply to new incoming connection. I will try again. regards, Gang On Mon, Jan 12, 2015 at 5:57 PM, Pieter Hintjens wrote: > You can change the TCP socket keep alive setting, yes. See > http://api.zeromq.org/4-2:zmq-setsockopt#toc42 > > On Mon, Jan 12, 2015 at 10:43 AM, Gang Liu wrote: >> After some tracing, I found this case could be repeated when client >> socket in connected state and I power off Wi-Fi router >> or turn off mobile device 3G DATA signal before zmq client do disconnect. >> >> Is there any way to enable broker's low level client TCP sockets >> KEEP_ALIVE option? I try to setopt at broker front end zsock, >> but don't help much. Yes, I am still thinking in BSD socket way. or do >> I need chose another zeromq pattern to handle clients no reliable inet >> connection? >> >> thanks for your kindly. >> >> regards, >> Gang >> >> >> >> On Mon, Jan 12, 2015 at 5:30 PM, Pieter Hintjens wrote: >>> These sockets are managed automatically by TCP. >>> >>> On Mon, Jan 12, 2015 at 7:41 AM, Gang Liu wrote: Dear all, I am new to zeromq. I have a question about message queuing broker (msgqueue.c) which use zmq_proxy() forward msgs between frontend and backend. In my testing code, the mobile client is using ZMQ_DEALER socket to connect to this broker. But after some time, I found there are more and more connected TCP at broker server side, all in ESTABLISHED state. I am sure there are no more than ten clients and even all apps in closed state. Because there are no way to get low level TCP sockets of broker, so is there any way to clean those "DEAD" TCP connections when clients at WI-FI or 3G env? regards, Gang ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev >>> ___ >>> zeromq-dev mailing list >>> zeromq-dev@lists.zeromq.org >>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev >> ___ >> zeromq-dev mailing list >> zeromq-dev@lists.zeromq.org >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev > ___ > zeromq-dev mailing list > zeromq-dev@lists.zeromq.org > http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] Message queuing broker for mobile device
You can change the TCP socket keep alive setting, yes. See http://api.zeromq.org/4-2:zmq-setsockopt#toc42 On Mon, Jan 12, 2015 at 10:43 AM, Gang Liu wrote: > After some tracing, I found this case could be repeated when client > socket in connected state and I power off Wi-Fi router > or turn off mobile device 3G DATA signal before zmq client do disconnect. > > Is there any way to enable broker's low level client TCP sockets > KEEP_ALIVE option? I try to setopt at broker front end zsock, > but don't help much. Yes, I am still thinking in BSD socket way. or do > I need chose another zeromq pattern to handle clients no reliable inet > connection? > > thanks for your kindly. > > regards, > Gang > > > > On Mon, Jan 12, 2015 at 5:30 PM, Pieter Hintjens wrote: >> These sockets are managed automatically by TCP. >> >> On Mon, Jan 12, 2015 at 7:41 AM, Gang Liu wrote: >>> Dear all, >>> I am new to zeromq. I have a question about message >>> queuing broker (msgqueue.c) which use zmq_proxy() forward msgs between >>> frontend and backend. >>> In my testing code, the mobile client is using ZMQ_DEALER >>> socket to connect to this broker. But after some time, I found there >>> are more and more connected TCP at broker server side, all in >>> ESTABLISHED state. I am sure there are no more than ten clients and >>> even all apps in closed state. >>> Because there are no way to get low level TCP sockets of >>> broker, so is there any way to clean those "DEAD" TCP connections when >>> clients at WI-FI or 3G env? >>> >>> regards, >>> Gang >>> ___ >>> zeromq-dev mailing list >>> zeromq-dev@lists.zeromq.org >>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev >> ___ >> zeromq-dev mailing list >> zeromq-dev@lists.zeromq.org >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev > ___ > zeromq-dev mailing list > zeromq-dev@lists.zeromq.org > http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] Message queuing broker for mobile device
After some tracing, I found this case could be repeated when client socket in connected state and I power off Wi-Fi router or turn off mobile device 3G DATA signal before zmq client do disconnect. Is there any way to enable broker's low level client TCP sockets KEEP_ALIVE option? I try to setopt at broker front end zsock, but don't help much. Yes, I am still thinking in BSD socket way. or do I need chose another zeromq pattern to handle clients no reliable inet connection? thanks for your kindly. regards, Gang On Mon, Jan 12, 2015 at 5:30 PM, Pieter Hintjens wrote: > These sockets are managed automatically by TCP. > > On Mon, Jan 12, 2015 at 7:41 AM, Gang Liu wrote: >> Dear all, >> I am new to zeromq. I have a question about message >> queuing broker (msgqueue.c) which use zmq_proxy() forward msgs between >> frontend and backend. >> In my testing code, the mobile client is using ZMQ_DEALER >> socket to connect to this broker. But after some time, I found there >> are more and more connected TCP at broker server side, all in >> ESTABLISHED state. I am sure there are no more than ten clients and >> even all apps in closed state. >> Because there are no way to get low level TCP sockets of >> broker, so is there any way to clean those "DEAD" TCP connections when >> clients at WI-FI or 3G env? >> >> regards, >> Gang >> ___ >> zeromq-dev mailing list >> zeromq-dev@lists.zeromq.org >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev > ___ > zeromq-dev mailing list > zeromq-dev@lists.zeromq.org > http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] Message queuing broker for mobile device
These sockets are managed automatically by TCP. On Mon, Jan 12, 2015 at 7:41 AM, Gang Liu wrote: > Dear all, > I am new to zeromq. I have a question about message > queuing broker (msgqueue.c) which use zmq_proxy() forward msgs between > frontend and backend. > In my testing code, the mobile client is using ZMQ_DEALER > socket to connect to this broker. But after some time, I found there > are more and more connected TCP at broker server side, all in > ESTABLISHED state. I am sure there are no more than ten clients and > even all apps in closed state. > Because there are no way to get low level TCP sockets of > broker, so is there any way to clean those "DEAD" TCP connections when > clients at WI-FI or 3G env? > > regards, > Gang > ___ > zeromq-dev mailing list > zeromq-dev@lists.zeromq.org > http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] Alternative efficiency design of lbbroker
> In any case, does what I am thinking about work? It's usually a good idea to make small pieces, and grow your understanding of your problem and alternative solutions like that. No-one here can do that for you. On Mon, Jan 12, 2015 at 7:31 AM, Kenneth Adam Miller wrote: > Instead of routing all information through the broker and requiring an > intermediary hop, I'd like to consider an approach where the address > information that the req socket parses out on the side that first sends > ready is used in order to manage a simple mutual connection facilitator in > ZMQ... > > Just like with load balancing broker from the manual, I have two parties > that mutually require one another. But I want to do simply a request to the > broker and receive the information I need in order to send directly to the > other entity. > > With router sockets, I get the address in a empty delimited set of message > sending convention. What I don't know is if I add a router socket to each > mutually requiring party, and -even if party A is not connected even to > party B- use the address information attained from the broker to send on > party A's router socket to party B and vice versa. Is this the best way to > do this? I don't want to manage a set of connected sockets. > > I realize that party A may have individual 1 and party B an individual 2 > where 1 & 2 repeatedly make connection over broker-I want to keep using > broker anyway, because broker allows each party to know when an individual > is ready in each. So the 1& 2 scenario is coincidental. > > But what I don't think is a good design idea is having a socket that makes > connect/close calls between each iteration to the broker or the idea of > having each endpoint know it's hostname or something (possibly I have > premature misgivings). > > In any case, does what I am thinking about work? Reading the target address > information gained from a router object and feeding it to a completely > different router object (where individual 1 may not have ever had his router > connected to individual 2 before)? > > ___ > zeromq-dev mailing list > zeromq-dev@lists.zeromq.org > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev