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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:07:32+00:00 2026-05-23T20:07:32+00:00

How can a client both subscribe and listen to replies with zeromq? That is,

  • 0

How can a client both subscribe and listen to replies with zeromq?
That is, on the client side I’d like to run a loop which only receives messages and selectively sends requests, and on the server side I’d like to publish most of the time, but to sometimes receive requests as well.
It looks like I’ll have to have two different sockets – one for each mode of communication. Is it possible to avoid that and on the server side receive “request notifications” from the socket on a zeromq callback thread while pushing messages to the socket in my own thread?

  • 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-23T20:07:32+00:00Added an answer on May 23, 2026 at 8:07 pm

    I am awfully new to ZeroMQ, so I’m not sure if what you want is considered best-practice or not. However, a solution using multiple sockets is pretty simple using zmq_poll.

    The basic idea would be to have both client and server:

    • open a socket for pub/sub
    • open a socket for req/rep
    • multiplex sends and receives between the two sockets in a loop using zmq_poll in an infinite loop
    • process req/rep and pub/sub events within the loop as they occur

    Using zmq_poll in this manner with multiple sockets is nice because it avoids threads altogether. The 0MQ guide has a good example here. Note that in that example, they use a timeout of -1 in zmq_poll, which causes it to block until at least one event occurs on any of the multiplexed sockets, but it’s pretty common to use a timeout of x milliseconds or something if your loop needs to do some other work as well.

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

Sidebar

Related Questions

I'm familiar with web programming, both client and server side, and I'd like to
I am reading WCF book.It states that the client can consume service running on
How can I create client proxy if I know only the type of service
How can I access client details like IP, browser, etc in a web service
I have MySQL running such that I can open a client command line and
Can you have custom client-side javascript Validation for standard ASP.NET Web Form Validators? For
Can I test my client side GWT code without GWTTestCase? I've heard somewhere (I
I have an application which has two client and for both client i have
I'm building an Objective-C app that has both a server and a client. The
I have a simple (very simple:) ) client and server which can send text

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.