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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:28:39+00:00 2026-06-04T04:28:39+00:00

If a client cancel its request, the application server is suposed to throw the

  • 0

If a client cancel its request, the application server is suposed to throw the following error :

java.net.SocketException: Connection reset by peer: socket write error

But what is exactly happening ?

Let’s say I’m doing a very expensive operation on the server side, and I’m writing some data to the outputstream everytime my server service get a new result (kind of streaming).
In the middle of this operation, the client cancel the request. What happens ?

The operation stops, because the socket throws this error when the connection closed ? If it’s not stopped, what happens to the data flushed in the outputstream after that ?

Thanks

  • 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-04T04:28:39+00:00Added an answer on June 4, 2026 at 4:28 am

    I can’t tell what Tomcat is doing but here is what happens:

    1. the client closed the socket gracefully (then the server is notified about the close and closes its side of the connection too, in which case any buffered data ready to be sent is lost);

    2. the client cut the socket brutally (then the server is NOT notified and it will detect the connection loss after a timeout or at the first attempt to send data – this will fail).

    So, if your streaming is “constant”, the server will always be ‘protected’ against undetected lost connections (the first send attempt will clean-up the area).

    If this streaming is not constant, then you should make room for a timeout, or use TCP Keep-Alives to make sure that the connection state is tested on a regulary basis.

    Hope it helps.

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

Sidebar

Related Questions

I have a file transfer application (server-client) ... while sending a file, i want
Is it possible to somehow cancel xmlrpc client request? Let say that in one
I've successfully connected to XMPP server (from android XMPP client), and I can send
I have implemented ntlmv2 for lync-server login in an custom made lync client.The message
I was wondering if there's a simple way to cancel an AJAX request? Beyond
I have this client application that sends thousands of items for deletion to my
I'm trying to cancel my AsyncTask when connecting to the server fails. I tried
i m making a client server program in which i want to switch from
I am working on an GWT-ext application. In this application I managed client side
My app is a client for a freeware PC-based PVR application which allows 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.