?
Solved

SocketException:  Connection reset by peer: socket write error

Posted on 2002-03-21
5
Medium Priority
?
1,467 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 1200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month16 days, 8 hours left to enroll

864 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