• 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

get "java.net.SocketException: socket closed", even if i am using HTTP connection

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I encountered an exception by executing this code:





The line of code that make this exception is: "int taille = input.read(mot);", if i copy it into the Servlet part, it works well, but i think that the Servlet shall not be in charge of these.

The exception is:
"java.net.SocketException: socket closed" even if i am not using Sockets, but HTTP.
I think that the "input" in RequestStatement's method contains no value "null"

Help me



 
Ranch Hand
Posts: 116
Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe that what is happening is that the RequestStatement thread is not finishing by the time the HTTP thread, which the servlet code is running on is finishing and closing the connection.
In this case I don't see a reason to start the second thread because you would have to synchronize and wait for it to complete before returning from the servlets doXXX method anyway. It will also complicate error handling, redirection and including content should that ever become necessary.
 
Dupont Girard
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Chris of your answer. You're right, i just put a join() on my thread and it works
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic