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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:04:11+00:00 2026-05-27T09:04:11+00:00

Background: we are having issues with one of our GPRS devices connecting through a

  • 0

Background: we are having issues with one of our GPRS devices connecting through a proxy to a generic handler. Although the handler closes the connection immediately after returning, the proxy keeps the connection open, which the device does not expect.

My question: is it possible, for testing purposes (in order to mimic the proxy’s behavior), to keep the connection alive for some short time, after a handler has returned its data?

For example, this does not work:

public class Ping : IHttpHandler
{
    public void ProcessRequest(HttpContext context)
    {
        context.Response.BufferOutput = false;

        context.Response.ContentType = "text/plain";
        context.Response.WriteLine("HELLO");
        context.Response.Flush();  // <-- this doesn't send the data

        System.Threading.Thread.Sleep(10000);
    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }
}

[Edit]

Ok, actually, it works as expected. The problem is that both Firefox and Fiddler delay showing the raw data until the connection is closed.

If Response.BufferOutput is set to false, and I use a terminal program to connect, I get the data immediately, and the connection remains open for 10s.

  • 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-27T09:04:11+00:00Added an answer on May 27, 2026 at 9:04 am

    You can write to the output stream and this will do what you want.

    byte [] buffer = new byte[1<<16] // 64kb
    int bytesRead = 0;
    using(var file = File.Open(path))
    {
       while((bytesRead = file.Read(buffer, 0, buffer.Length)) != 0)
       {
            Response.OutputStream.Write(buffer, 0, bytesRead);
             // can sleep here or whatever
       }
    }
    Response.Flush();
    Response.Close();
    Response.End();
    

    Check out Best way to stream files in ASP.NET

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

Sidebar

Related Questions

Having issues displaying some websites within iframes. Live example of code This one works.
I'm having some issues with an iPhone app crashing when it comes from background,
I am having issues of having an image change dynamically. Some background info: I
I'm having a few issues with my background not showing for my button elements.
I'm having some issues with maintaining scroll bar locations. The Background I have a
I'm having issues with this particular site not showing one of the backgrounds. I
Having an issue resizing the #main_wrap on: http://www.coffeeproteindrink.com/method-athlete/ #main_wrap { min-height: 100%; background: url(images/content_back.png)
Background I'm having a bit of trouble finding out just how to programmatically post
The background: I'm having some problems with Thoughtbot's Factory Girl gem, with is used
Having a background in Java, which is very verbose and strict, I find the

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.