[zeromq-dev] Reconnect failed after iptables tricks
artemv zmq
artemv.zmq at gmail.com
Tue Dec 17 18:11:04 CET 2013
hi Pieter,
Thank you! This one helped:
>> I'd add a timeout on recv and if there's no reply, take action
So, after small refactoring a client can handle reconnect:
http://pastebin.com/7bVRRuS8
But, by default (when recv_timeout=-1, which means -- await for message
forvever), client thread will hang on .recv(). Even though connection has
been re-established (via iptables command on server host).
So seems like that this does render the fact that reconnection is not
something you get out-of-the-box. Client should not forget to set
recv_timeout > 0.
2013/12/17 Pieter Hintjens <ph at imatix.com>
> You're right, I leaped before thinking, sorry. The code looks accurate.
>
> If the dealer closes and reopens the socket does that work? (I'd add a
> timeout on recv and if there's no reply, take action).
>
> If the dealer does a disconnect and a new connect, does that work?
>
> Presumably the client is caching some connection data that goes out of
> date, or else TCP is not providing an error on the IP change.
>
> This behavior is not documented, so once we know what is actually
> going on we can decide how to handle it and fix it
>
> Yes, it's a bug in the sense that all improvements are bugs. No, it's
> not a bug in the sense that the software is working out of spec, since
> this aspect isn't specified.
>
> Sorry again for not being patient... it has been a long day. You
> should please next time start the thread with code. That works much
> better (and it's explained on the website).
>
> -Pieter
>
> On Tue, Dec 17, 2013 at 3:28 PM, artemv zmq <artemv.zmq at gmail.com> wrote:
> > Socket identity is going to be "prefixed" to the outgoing DEALER
> message.
> > So, on ROUTER side there will be 3 parts.
> >
> >
> > 2013/12/17 Pieter Hintjens <ph at imatix.com>
> >>
> >> Why is the ROUTER expecting 3 parts when the DEALER sends 2?
> >>
> >> On Tue, Dec 17, 2013 at 3:13 PM, artemv zmq <artemv.zmq at gmail.com>
> wrote:
> >> > Ok. Got it. Here's pastebin snippet: http://pastebin.com/9fr8W0RA
> >> >
> >> >
> >> >
> >> >
> >> > 2013/12/17 Pieter Hintjens <ph at imatix.com>
> >> >>
> >> >> On Sat, Dec 14, 2013 at 6:47 PM, artemv zmq <artemv.zmq at gmail.com>
> >> >> wrote:
> >> >>
> >> >> > There's no sense to paste code. Client is - DEALER. Server is
> >> >> > ROUTER.
> >> >> > Inside infinite loop client sends a message and await for reply. By
> >> >> > turn
> >> >> > server -- inside infinite loop receives message and sends answer
> >> >> > back.
> >> >> > All
> >> >> > socket settings -- by default. That's it.
> >> >>
> >> >> There are good reasons we make test cases for issues, and that the
> >> >> wiki site says, "make a minimal test case". If it is trivial, please
> >> >> post code. If it's not trivial, make it trivial, then please post
> >> >> code.
> >> >>
> >> >> The group will otherwise ignore you (and rightly so).
> >> >>
> >> >> -Pieter
> >> >> _______________________________________________
> >> >> 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
> >
> >
> >
> > _______________________________________________
> > 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/20131217/a410aae3/attachment.htm>
More information about the zeromq-dev
mailing list