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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:28:23+00:00 2026-06-17T16:28:23+00:00

In Code Connected book volume 1(page 23) there is a example for using PUSH

  • 0

In Code Connected book volume 1(page 23) there is a example for using PUSH, PULL messaging. Before closing sockets it uses sleep(). Here is the code:

printf("Total expected cost: %d msec\n", total_msec);
sleep(1); // Give 0MQ time to deliver

zmq_close(sink);
zmq_close(sender);
zmq_ctx_destroy(context);

What is that sleep(1) about? Is this general rule?

  • 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-17T16:28:24+00:00Added an answer on June 17, 2026 at 4:28 pm

    The sleep (1) in taskvent.c and tasksink2.c were hangovers from when the examples still used 0MQ/2.2, and you can delete these two lines of code, if you’re running on 0MQ/3.2. I’ve just done that, tested, and it works as you’d expect.

    The reason: in 2.2, sockets were destroyed and messages discarded, when you terminated the context. In 3.2, messages will be delivered within a timeout specified by the LINGER socket option, which is by default infinite.

    There are lots of other examples that use “sleep”, for good reasons:

    • to simulate a workload
    • to let a set of peers in a demo start-up and connect
    • to let a set of peers in a demo shutdown
    • to retry after an error

    You can do start-up and shutdown synchronization differently but it gets more complex than we want in simple examples.

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

Sidebar

Related Questions

I'm learning Java Servlets and the book I'm using has an example on file
I tried the below code to check whether my mobile is connected to a
I'm currently thinking of developing chess code with multi-player facility connected and played via
Suppose, I have a connected socket after writing this code.. if ((sd = accept(socket_d,
I'm using Valgrind --tool=drd to check my application that uses Boost::thread. Basically, the application
For face book and Google Plus I am getting 407 and 403 result code.
I am using the FB Registration plugin with the following code: <html xmlns:fb=http://ogp.me/ns/fb#> <script
Everything in my code works but $num_results... Book-O-Rama Search Results Book-O-Rama Search Results //create
Iam just a beginner student socket programming.I tried a simple code from TCP/IP Sockets
I'm trying to parse JSON Using ASIHttpRequset I wrote this code -(void) tryASIHttpRequest{ NSString

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.