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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:02:09+00:00 2026-05-24T04:02:09+00:00

Consider the following scenario, a servlet has been written in Java and once you

  • 0

Consider the following scenario, a servlet has been written in Java and once you connect to the servlet, it starts writing to the OutputStream, let’s say 10 million bytes, 1 byte at a time.

You have a client program which reads the servlet’s response stream and reads say 100 bytes and calls close. Now if your client program is in Java, the streams close immediately and the server stops sending the content, but if the client program is in C#, the close call takes a long time to finish because it apparently waits for server to finish writing all the 10 million bytes.

So, I have two questions on this,

  1. Why does C# behave differently?
  2. What can I do to ensure the Close call on the C# stream closes the stream immediately and does not allow the server to keep sending the data?

Any pointers will be greatly appreciated 🙂

  • 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-24T04:02:10+00:00Added an answer on May 24, 2026 at 4:02 am

    So, I finally figured this out a couple of weeks back and verified it with Microsoft as well. The difference between C# and Java is the fact that in Java close call closes the request/connection as well, while in C#, it doesn’t happen unless you follow it up with an xxxRequest.Abort() call. Hope this helps someone else as well.

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

Sidebar

Related Questions

Consider the following scenario: Someone has a project on Github that might be updated
I have question about try, catch and finally in Java. Consider the following scenario:
And wait, don't rush to answer java.util.Date, consider the following scenario. Person object having
Consider the following scenario: Page written in classic ASP or PHP, which is rendering
Consider the following scenario: There are three kinds of entities, say Foo , Bar
Please consider the following scenario: map(T,S*) & GetMap(); //Forward decleration map(T, S*) T2pS =
Consider following scenario: I have RESTful URL /articles that returns list of articles user
Consider the following scenario: Tables: Employee (EmpId(PK), Name) TeamMembers(TeamId(PK), EmpId(PK)) Project(ProjId(PK), TeamId) I really
Consider the following scenario which I'm due to find myself in shortly: You're to
Consider the following scenario . I have an array of numbers: [ 1,2,3,4 ]

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.