Get method using indy 9 component

Hi! I'am using an indy 9 component to do a get method. But if any problem occur like read time out the next requests doesn't anything. Have I gotta do anything when it happen like disconnect or close?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Yes,  you should use catch the exception and shut down the socket something like this,
  AnsiString sURL = "<address>";
  TMemoryStream *ResultMS;

    { // Get Method with a memory stream to load the result into
      HTTP->Get(sURL, ResultMS);
    catch(Exception& e)
      AnsiString sErrorMsg = e.Message;     // maybe do something here with the error message

You use DisconnectSocket() to force the socket to clear.  There is also a Disconnect() method but DisconnectSocket is recommended to clear a socket after errors.  Check the indy help file for a more detailed explaination of the differences.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
George TokasCommented:
One more oppinion....
I like beter the THTTP component when I have to deal with Get property...
If an error occurs you will see it at the Header property and the connection is cleared immediatetly...
There was a time I made an app with Indy component IdTime, THTTP, and CppWebBrowser component to do a task...
3 different components to do a task someone else could do with only one, not to mention the slight delay especially in slow machines...
So.. What I mean is that sometimes we (programmers) have to use some other techniques to bypass problems occured...:-)

directcallAuthor Commented:
I can´t use THTTP component because it doesn´t authentication method. The indy 9 has it.
George TokasCommented:
TCppWebBrowser can be used with the options you want...:-)
BUT to find your way to use it could be hell and waste of precious time...:-)
I'm working with it for 3 years now and still trying to do what I have to with it...
Thats why I wrote in my post about 3 components...

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.