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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:17:49+00:00 2026-05-28T07:17:49+00:00

So I was recently doing some work, when somebody told me that if doing

  • 0

So I was recently doing some work, when somebody told me that if doing a Stream.Read on a network stream that is obtained from calling one of .NET’s GetResponseStream on a WebResponse or those are buffered.

He was saying that if you were to put a breakpoint, in the code where you’re reading, you wouldn’t stop the network traffic. I find that bizzare, but also hoping that it’s true. How does that work? Is it even accurate?

using (Stream webResponseStream = this.webResponse.GetResponseStream())
{
   byte[] readBuffer = new byte[bufferSize];
   int bytesRead = webResponseStream.Read(readBuffer, 0, bufferSize);
   while (bytesRead > 0)
   {
        bytesRead = webResponseStream.Read(readBuffer, 0, bufferSize);
        // If I put a breakpoint here, does network activity stop?
   }
}
  • 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-28T07:17:50+00:00Added an answer on May 28, 2026 at 7:17 am

    No, the Stream object returned by GetResponseStream is not buffered.

    Short answer to your second part (about setting a breakpoint) is that your co-worker is incorrect. Network traffic will stop, but eventually, and to describe “eventually”, read on for more details.

    Bing for “SO_RCVBUF”, “tcp receive window size”, “vista auto scaling”, for even more general information.

    Detailed Part

    Let’s start with this, here’s a textual view of the Windows networking stack:

    ++ .NET Network API’s

    ++ — Winsock DLL (user mode)

    ++ —— afd.sys (kernel mode)

    ++ ——— tcpip.sys

    ++ ———— ndis

    ++ ————— network interface (hal)

    This is a rough stack, glossing over some details, but the general idea is that .NET calls into Winsock user-mode dll, which then pushes most of the real work to its cousin AFD (Ancillary Function Driver), onwards to the tcpip sub system, so on ..

    At the AFD level, there is a buffer, generally between 8K and 64K, but with Vista (and beyond), it can also scale up. This setting can also be controlled by a registry setting(HKLM\SYSTEM\CurrentControlSet\services\AFD\Parameters).

    In addition, the tcpip.sys also has a buffer, that is similar to AFD’s buffer. I believe *SO_RCVBUF* setting passed when opening the socket can change this too.

    Essentially, when you are receiving data, tcpip.sys on your behalf keeps getting data, and keeps the telling the sender that it got the data (ACK‘s), and does so until its buffers are full. But at the same time, afd.sys is clearing tcpip.sys buffers by asking it for the data (which it then copies into its own buffer), so tcpip.sys can fill more data from the sender.

    And then there’s you (the .NET API caller), who is also doing the same, calling the Read() method and copying data into your buffer.

    So, if you think about it, a 256Kb message coming over the wire, 64K sitting in the tcpip.sys buffer, 64K sitting in afd.sys buffer, and you set a breakpoint after asking for one 4K (your bufferSize variable) chunk, we’re looking at 128K ACK’ed back to the sender as received, and since the tcpip.sys buffer is full (assuming 64K size) now (and you’re blocked by your debugging session), tcpip.sys will no have option but to tell the sender to stop sending being bytes over the wire, because it can’t process them quick enough.

    Practically (i.e. somebody not setting a breakpoint!), I’ve seen GC to induce such behavior. Seen a case of a 3 second garbage collection that let all the OS buffers fill up.

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

Sidebar

Related Questions

Recently I'm doing some work on RTMP streaming, that is using Flowplayer to integrate
I have recently been doing some work that has been quite in depth, i
I've recently started doing some JSF work - before that I've always used PHP
One thing I've started doing more often recently is retrieving some data at the
I have an old MonoRail/ActiveRecord I've been doing some work too. Recently I decided
I've been doing some web development work in PHP recently which has led me
I've been doing lots of work recently on the new Workflow 4.0. One of
I'm doing some work for a department that has a pretty basic table structure
I have been doing some statistics work with Stata recently and not enjoying it
I just recently made the move to Objective-C. I am doing some exercises from

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.