| Author |
what does this Exception mean???thanx!@!!!
|
Javan Li
Ranch Hand
Joined: Jul 24, 2002
Posts: 84
|
|
|
java.net.SocketException: Connection reset by peer: JVM_recv in socket input stream read
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
From The java.net.SocketException Class Documentation:
Thrown to indicate that there is an error in the underlying protocol, such as a TCP error.
|
[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
|
 |
Dave Landers
Ranch Hand
Joined: Jul 24, 2002
Posts: 401
|
|
Often it means that the "other end" of the socket closed its stream. For example, if you see this on a web server, it might mean that a user killed their browswer while in the middle of loading a page. The browser went away, so the server saw the connection being reset (killed) by the peer (the other guy - browser). Can mean other things, but this is the most common I've seen.
|
 |
Javan Li
Ranch Hand
Joined: Jul 24, 2002
Posts: 84
|
|
|
Does it do harm to my C/S program? Whether i should do something??
|
 |
Dave Landers
Ranch Hand
Joined: Jul 24, 2002
Posts: 401
|
|
It depends on the circumstance. If you have written the code on both sides of the socket and you think you are reading the streams fully and closing them only when you are done, this exception might mean you are loosing data. For this, you need to make sure you read the streams fully (to the end) and don't close EITHER input or output stream from a socket until you are finished with both of them (closing either will close the socket). If you have written a server and the clients are not in your control (for example a browser in somebody's bedroom), then it might mean that the client disconnected.
|
 |
Javan Li
Ranch Hand
Joined: Jul 24, 2002
Posts: 84
|
|
Thanx a lot, u are great help!
|
 |
Marilyn de Queiroz
Sheriff
Joined: Jul 22, 2000
Posts: 9033
|
|
|
Sockets are not for "beginners". I'm moving this to Java in General (intermediate)
|
JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
|
 |
 |
|
|
subject: what does this Exception mean???thanx!@!!!
|
|
|