Solved

SocketException:  Connection reset by peer: socket write error

Posted on 2002-03-21
5
1,439 Views
Last Modified: 2008-03-10
I have a java based web server which streams data to an applet.  Occasionally the connection between the applet and server is broken.  the message on the server is SocketException: Connection reset by peer: socket write error.   After the connection is broke it appears the client side still thinks the connection is open and is blocking on a read.

The connection is a tunnel on port 80 which simulates a long file download.  Any ideas on what could cause the exception besides the obvious network error or the user closing the browser?  

I'm running JRE 1.2.2 on the server.  The applet is a standard applet under MSIE 5.5.
0
Comment
Question by:richp
5 Comments
 
LVL 16

Accepted Solution

by:
heyhey_ earned 300 total points
ID: 6886424
> The connection is a tunnel on port 80

is there a proxy between applet and server ?

Anyway you should ALWAYS track logical speed (i.e. check if there is data coming every 5 seconds) and close the connection if there is no new data. Some TCP implementations may report error after timeout of more than 10 minutes.
0
 

Author Comment

by:richp
ID: 6886452
Some clients use a proxy some do not.  

We send a heartbeat every 15 seconds so there should always be new data.
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 6886469
I have seen similar behaviour in various situations.
Connection in half-closed state (perfectly valid state according to the TCP RFC) may be caused by proxy, modem disconnection or various other communication problems.

The only possible solution is to start additional Thread that will check in new data is coming every 15 seconds and close the Socket if needed (this will unblock .read() operation)
0
 
LVL 9

Expert Comment

by:Venci75
ID: 7901124
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Answered by: heyhey_
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Venci75
EE Cleanup Volunteer
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7962548
Per recommendation, force-accepted.

Netminder
EE Admin
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now