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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:43:52+00:00 2026-05-29T08:43:52+00:00

I have an existing multi-threaded C++ program which uses a pool of sockets for

  • 0

I have an existing multi-threaded C++ program which uses a pool of sockets for read and write.
The sender thread sends HTTP requests using the next available socket.
The receiver therad polls the pool of sockets (using the poll() method) and read the HTTP responses.
How the receiver thread can detect a possible HTTP response timeout from a socket of the pool?

  • 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-29T08:43:53+00:00Added an answer on May 29, 2026 at 8:43 am

    Quick example off the top of my head:

    1. when you send a request, create an object containing the fd, any logical connection info you need, and the absolute time at which you’ll consider it timed out
    2. keep a priority queue of these objects ordered by time, so the soonest-to-expire is always at the front (this degenerates to a FIFO queue if all requests get the same timeout)
    3. when you poll, calculate the timeout from now to the first absolute time on the queue
    4. if poll returns zero (or just every time it wakes up), get the current time and walk the queue timing out any requests whose timeout is now in the past
    5. when you get a successful response, you’ll need to remove the associated object from the queue as well
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an existing multi-threaded application which uses blocking connect() call. However, I want
I have implemented a java program . This is basically a multi threaded service
I have an application which are multi threading. I notice some existing code use
I have existing code that uses CMNewProfileSearch to find then iterate over the color
I have existing Linux shared object file (shared library) which has been stripped. I
I have written a multithreaded program which does some thinking and prints out some
I have an existing multi-instance SQL 2008 cluster, and I'm trying to add Analysis
I have an existing ASP.NET website which I would like to painlessly add CMS
I have some existing code that I've used to write out an image to
Reproducing the new array from existing array(multi array) If I have an array called

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.