• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Socket error: connection reset by peer ??

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
I'm not dead! I feel happy! I'd like to go for a walk! I'll even read a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic