Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Socket error: connection reset by peer ??  RSS feed

 
Tiago Massoni
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi people,
I'd like to expose my problem, because I couldn't find a solution for that. I have a JSP page that executes a method, which retrieves information from a database and show it to the user.
The user press an Execute button, then the method is called and th results are shown. The problem I have is if the user stops (using the stop button in the browser) before the execution finishes.
No problem for the user that stops, but the next user that executes the method receives both results, the first one and the his correct result. (and an socket error is raised, Connection reset by peer).
Do you know how I can avoid this strange behaviour?
Thanks in advance,
Tiago.
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Do you know how I can avoid this strange behaviour?

Seems perfectly normal behaviour to me
The thing with sockets is that before closing down they should tell the other end they are doing so. So you need to place a message in the socket which will be understood by the other end and the appropiate action will be taken ( catering for both client and server shutdowns ).
If you are dealing with more than one client you will have to handle concurrent access on the socket and make sure you avoid one client getting anothers data. There are some good tutorials on the Sun website about sockets and threads.
Hope that helps,
Terry
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!