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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:31:08+00:00 2026-06-10T17:31:08+00:00

This question concerns general concepts surrounding the tcp/ip protocol, for which there are already

  • 0

This question concerns general concepts surrounding the tcp/ip protocol, for which there are already good answers on So, but I’m hoping to gain some insight into the particularities of the node.js http/net libraries.

A node http Server instance allows for callbacks to be registered for two type of events, ‘request’ event, and ‘connection’, event. The later of these is inherited from the net library, along with a field ‘_connections’, which counts the number of concurrent connections the server currently has.

Now, it seems to me that since http is a stateless protocol, there should be a 1-1 to correspondence between request and connection events–but this is not the case. When stepping through a simple ‘hello-world’ server in my debugger, I saw that the number of request events outnumber the connection events. I also saw that, even when no calls were being made to the server (and the process was no paused), the .connections field would never zero out. Why would the number of requests not equal the number of connections, and why would the server keep a connection open well after the final call to response.end() (when the response buffer is supposed to be flushed and the connections ended?).

Also, how could the number of concurrent connections for an http server (that doesn’t do anything with keep-alive) ever be higher than 1? Don’t requests basically get queued up on the socket and processed one by one? I understand that Node is asynchronous, but I also thought it behaves in a single-threaded manner.

Thanks in advance!

  • 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-10T17:31:10+00:00Added an answer on June 10, 2026 at 5:31 pm

    HTTP is stateless, but it runs over TCP, which is not stateless.

    By setting the HTTP request header Connection: keep-alive, it is possible (and often used) to keep the underlying TCP connection open. This is a performance optimization, since TCP connections can be expensive to set up and tear down repeatedly.

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

Sidebar

Related Questions

This question concerns a Tomcat 7 web application, which is connected to a MySQL
There are a series of prior questions that tangentially ask this question, but not
I am aware of this question , but I believe my concerns are very
I know this kind of question has been asked before, but the general solution
This question is about good programming practices and avoiding potential holes. I read Joshua
This question concerns running python files in terminal that are not stored in the
This question concerns the reflection mechanisms of the java programming language. I have an
This is a general question on optimization technique and please I am more than
Possible Duplicate: What's the point of valid CSS/HTML? This is a over-asked question, but
This is a general programming question (it doesn't have a specific purpose/application yet). If

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.