• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what does this Exception mean???thanx!@!!!

 
Javan Li
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.net.SocketException: Connection reset by peer: JVM_recv in socket input stream read
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From The java.net.SocketException Class Documentation:
Thrown to indicate that there is an error in the underlying protocol, such as a TCP error.
 
Dave Landers
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does it do harm to my C/S program? Whether i should do something??
 
Dave Landers
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx a lot, u are great help!
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sockets are not for "beginners". I'm moving this to Java in General (intermediate)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic