aspose file tools*
The moose likes Java in General and the fly likes What Does Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "What Does "Connection reset" Message Mean and How Can I Prevent It?" Watch "What Does "Connection reset" Message Mean and How Can I Prevent It?" New topic
Author

What Does "Connection reset" Message Mean and How Can I Prevent It?

Kevin Simonson
Ranch Hand

Joined: Oct 22, 2011
Posts: 113
I have a couple of very simple Java programs, "SeBug.java" that takes three arguments, and "ReBug.java" that takes two. The first argument for "SeBug.java" is the port of the socket to use for communication between the two programs, and so is the first argument for "ReBug.java". The second argument for "SeBug.java" is a base to be raised to different powers, and the third argument is the number of powers to be raised to. The second argument for "ReBug.java" is the IP address of the machine I'm executing "SeBug.java" on. The actual code of "SeBug.java" is:

and the actual code of "ReBug.java" is:

When I run "java SeBug 13267 2 5" on machine "10.35.4.226" and then run "java ReBug 13267 10.35.4.226" several times in succession on a different machine, the result I get on the second machine is:

Script started on Thu 26 Jan 2012 06:53:18 PM GMT
simonsonkm@nncd-077-049 cds-dev:~/Java$ java ReBug 13267 10.35.4.226
Read power 1.
simonsonkm@nncd-077-049 cds-dev:~/Java$ java ReBug 13267 10.35.4.226
<IOException> thrown with message "Connection reset".
simonsonkm@nncd-077-049 cds-dev:~/Java$ java ReBug 13267 10.35.4.226
Read power 2.
simonsonkm@nncd-077-049 cds-dev:~/Java$ java ReBug 13267 10.35.4.226
Read power 4.
simonsonkm@nncd-077-049 cds-dev:~/Java$ java ReBug 13267 10.35.4.226
<IOException> thrown with message "Connection reset".
simonsonkm@nncd-077-049 cds-dev:~/Java$ java ReBug 13267 10.35.4.226
Read power 8.
simonsonkm@nncd-077-049 cds-dev:~/Java$ java ReBug 13267 10.35.4.226
<IOException> thrown with message "Connection reset".
simonsonkm@nncd-077-049 cds-dev:~/Java$ java ReBug 13267 10.35.4.226
Read power 16.
simonsonkm@nncd-077-049 cds-dev:~/Java$ exit
exit

Script done on Thu 26 Jan 2012 06:53:51 PM GMT

Does anybody know what the message "Connection reset" means when <IOException> is thrown the second, fifth, and seventh time I execute program <ReBug>? And what can I do to read the data without this exception getting thrown?

Kevin Simonson
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18896
    
  40

Kevin Simonson wrote:Does anybody know what the message "Connection reset" means when <IOException> is thrown the second, fifth, and seventh time I execute program <ReBug>? And what can I do to read the data without this exception getting thrown?


A "connection reset" means that the network connection was close improperly, by the other side. It could be that the other application died. It could be that the network switch/router failed. etc.

Regardless, you can't do anything about the connection reset, at the application that got the reset exception -- as it is an error that occurs elsewhere. To fix this problem, you need to fix it where it occurs.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What Does "Connection reset" Message Mean and How Can I Prevent It?