This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes How to reestablish the connection after a SocketException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "How to reestablish the connection after a SocketException" Watch "How to reestablish the connection after a SocketException" New topic
Author

How to reestablish the connection after a SocketException

Ray Clark
Ranch Hand

Joined: Aug 16, 2012
Posts: 52
There is a project at work that makes calls out to Facebook.

Currently the code gets a socket exception sometimes. When it does it tries to clean up (code I added), sleeps and then retries. Problem is, it continues to get a socket exception so the clean up isn't working. The program finally gives up but subsequent runs of the program (it's cronned) work. I haven't used httpGet and httpClient before, does anyone have any advice on how to clean things up and reestablish the connection?

This is what the code looks like right now:



Any advice is greatly appreciated.

Thanks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to reestablish the connection after a SocketException
 
Similar Threads
how can i use remote database sqlserver from my andriod application?
Get the jsp content from a struts action in OC4J
SocketException:socket closed
Servlet redirect to another server
Connecting to https urls from Java