Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6624993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:43:12+00:00 2026-05-25T21:43:12+00:00

I just got started with ZMQ. I am designing an app whose workflow is:

  • 0

I just got started with ZMQ. I am designing an app whose workflow is:

  1. one of many clients (who have random PULL addresses) PUSH a request to a server at 5555
  2. the server is forever waiting for client PUSHes. When one comes, a worker process is spawned for that particular request. Yes, worker processes can exist concurrently.
  3. When that process completes it’s task, it PUSHes the result to the client.

I assume that the PUSH/PULL architecture is suited for this. Please correct me on this.


But how do I handle these scenarios?

  1. the client_receiver.recv() will wait for an infinite time when server fails to respond.
  2. the client may send request, but it will fail immediately after, hence a worker process will remain stuck at server_sender.send() forever.

So how do I setup something like a timeout in the PUSH/PULL model?


EDIT: Thanks user938949’s suggestions, I got a working answer and I am sharing it for posterity.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:43:12+00:00Added an answer on May 25, 2026 at 9:43 pm

    If you are using zeromq >= 3.0, then you can set the RCVTIMEO socket option:

    client_receiver.RCVTIMEO = 1000 # in milliseconds
    

    But in general, you can use pollers:

    poller = zmq.Poller()
    poller.register(client_receiver, zmq.POLLIN) # POLLIN for recv, POLLOUT for send
    

    And poller.poll() takes a timeout:

    evts = poller.poll(1000) # wait *up to* one second for a message to arrive.
    

    evts will be an empty list if there is nothing to receive.

    You can poll with zmq.POLLOUT, to check if a send will succeed.

    Or, to handle the case of a peer that might have failed, a:

    worker.send(msg, zmq.NOBLOCK)
    

    might suffice, which will always return immediately – raising a ZMQError(zmq.EAGAIN) if the send could not complete.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just started to learn Ruby and got a good take on the
I have a java application for an ATC. I just got started with the
I just got started with php. I have a form in a web page
I just got started with core data. I have bunch of entities with about
I just started reading Effective C++ today and got to the point where the
So ive just started learning python on WAMP, ive got the results of a
I just got Delphi 2009 and have previously read some articles about modifications that
I just got started with rails, and when I testing in development mode, I
So I just got started in Rails, and I'm trying to create an Object
I just started using C# and I've got a couple of issues. Is there

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.