Solved

SocketException:  Connection reset by peer: socket write error

Posted on 2002-03-21
5
1,446 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
servlet requestdispatcher include and forward differences 1 39
java stored proc example 9 44
Unhandled exception type Exception 18 42
Html Table Looping (part 2) 5 27
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.

792 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