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 8774013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:27:15+00:00 2026-06-13T18:27:15+00:00

I’m using PyZMQ to create a request/reply server, and I’m trying to figure out

  • 0

I’m using PyZMQ to create a request/reply server, and I’m trying to figure out if the act of creating a thread for each new client connection is handled by PyZMQ automatically. Ultimately, I’m trying to figure out if a request from one client that takes a long time to reply to will block requests from all other clients.

Normally, I would call accept on a Python socket instance, block until a new connection is made, and handle any new connections in separate threads. However, PyZMQ sockets do not seem to support such a workflow. So, how is this handled in PyZMQ? If a PyZMQ REP socket has multiple clients connected to it, how does it go about correctly routing replies back to the clients that made the requests? And, how can I go about designing my code such that requests from other clients aren’t blocked when a client makes a long-running request?

I know I could use the Tornado-based EventLoop provided with PyZMQ, I’m just trying to better understand how it would work if that weren’t an option.

  • 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-06-13T18:27:16+00:00Added an answer on June 13, 2026 at 6:27 pm

    ZeroMQ exposed as “sockets on steroids”, but there is another approach for implementing a communciation.

    First of all, forget about wire that links peers in traditional sockets. In 0mq, you have a “quantum teleporter”, which delivers your messages from one piece of code to another, hiding actual delivery work from you. You can’t just ask 0mq how many clients are connected to the socket or if you have clients at all. ZeroMQ cannot be used as a drop-in replacement for sockets because of that.

    Instead, 0mq gives you a magician hat you take some white rabbits from. Imagine that bottom of that hat connected with a gigantic network of pipes with multiple factories of wonderful things on the other side. These factories sometimes send some stuff to your hat, and when you get from the hat you can find yourself with a rabbit in your hands, or bouquet of flowers or something other. You cannot determine from what factory that thing had been sent unless there was an explicit sticker on that thing (i.e. one part of multipart message points to origin of the message).

    After you take the rabbit from the hat, you may want to send something back, and 0mq will behave differently for different socket types. For REP sockets, it will send answer directly to origin of message, for DEALER will round robin answers across connected peers, and ROUTER gives you immense knowledge of exact internal address of peer when receiving message and allows you to set explicit destination while sending message.

    To sum it up, if you want a separate thread for each communicating client you need the following things:

    • Clients should identify themselves explicitly.
    • On server you run one thread (dispatcher) that receives messages, get a client identity from it and chooses a thread for processing.
    • Dispatcher sends this message to thread (or spawns one) and continues serving incoming message flow.
    • Thread receives message, processes it and sends answer to client via dispatcher (if it needs to).
    • Dispatcher routes answer to client.

    This is a way to implement “multi-client socket server on zeromq” with classic socket knowledge in mind.

    But it is not a 0mq approach for the problem.

    In 0mq you can just put your processing logic in one thread (dispatcher from the example above) and implement it as a loop receive request -> process -> send answer -> receive .... Fits perfectly when processing time is not a question. But when it is, 0mq-style solution involves task-queue broker between clients and workers (which perform actual work). And then, broker logic is a little more complicated than a receive-answer loop mentioned above, and the worker is implemented in the same way. See examples in zguide – A Request-Reply Message Broker

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I want use html5's new tag to play a wav file (currently only supported

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.