Thanks, I really like this idea.  

I was trying to keep my server stateless, but so far haven't come up with a way 
to do that.  

Maybe there isn't a stateless way or socket pattern that will handle this case.

________________________________
From: Doron Somech <[email protected]>
To: Russell Della Rosa <[email protected]>; ZeroMQ development list 
<[email protected]> 
Sent: Saturday, March 21, 2015 2:44 PM
Subject: Re: [zeromq-dev] Ping Pong Heartbeats & Quick Server Restart Issue



Make the protocol between the client and server stateful and have some kind of 
handshake between client and server.

So when the server dies and then restart quickly, client sending a ping message 
will be replied with an error as the server doesn't know the client. The client 
then will re-initiate the handshake and will expire immediately any pending 
requests which you can know resend. To summarize:

1. Have handshake / login process between client and server
2. Server has a hash table of all clients (routing id to client) - which it 
added client to it as part of the handshake process
3. Client sends a ping every X seconds
4. Server receives a ping and reply with pong if the client is known or error 
if client is unknown
5. Client that receives an error from a ping re-initiate the handshake/login 
process
6. Client immediately expire pending requests when error is received / or 
resending all pending requests after handshake is completed





On Fri, Mar 20, 2015 at 8:53 PM, Russell Della Rosa 
<[email protected]> wrote:


>
>Question:
>---------
>I'm curious if anyone has solved this quick server restart problem in a clean 
>way with socket patterns?  Or if you have other suggestions?  
>
>
>Or if you have example code of ping/pong handling this case I'd love to see it.
>
>
>Thanks!
> -- Russell
>
>
>Related threads:
>----------------
>Disconnects / Retry Logic - 
>http://lists.zeromq.org/pipermail/zeromq-dev/2012-January/015024.html
>Using a router with an identity issue - 
>http://lists.zeromq.org/pipermail/zeromq-dev/2014-February/025206.html
>
>
>_______________________________________________
>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

Reply via email to