• 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

SocketTimedOutException while reading inputStream.

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am facing a weird problem. I am writing some code in one eclipse plugin.
Plugin makes a request to server using java.net.HTTPURLConnection by writing some data to output stream and reads the returned data from the inputStream.

When it tries to read the data from the inputStream returned by the connection (see code snippet below)

where b is byte. It throws SocketTimedOutExcption.
Now as far as i understand HTTPURLConnection class (may be i am wrong) . It by default has a ReadTimeOut set to 0 (0 means infinite wait here)..
So in my opinion it should wait until unless server returns the response. Also HTTPURLConnection is Synchronous, so it should wait until unless server returns data (within timeout limit).

I put the above code in while loop to retry and after retrying a couple of time it works. By retry i mean i sent my request only once but i retry on reading the inputStream (response from server).

Problem became worst when we noticed that its only replicable ONLY ON install i.e. it dosen't come when i tried debugging it in development enviornemnt.
If you want full code i will paste that here also.. just let me know
 
Ranch Hand
Posts: 820
IntelliJ IDE VI Editor Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm curious to see why this is happening. I'll try installing the plugin. Can you attach it as a zip?
 
ashutosh dhiman
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, i can not share the plugin. As its my company code and i am bound not to do so, legally.. I am really really sorry for that. Can you tell me how you would have debug it? i mean does taking java dumps or anything like that will help? or you can guide me what should i do.. Thanks for your reply..
 
That new kid is a freak. Show him this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic