Get method using indy 9 component

Posted on 2005-03-03
Medium Priority
Last Modified: 2013-11-17
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?
Question by:directcall
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 25

Accepted Solution

kode99 earned 1500 total points
ID: 13454033
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.

LVL 16

Expert Comment

by:George Tokas
ID: 13457687
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...:-)


Author Comment

ID: 13457800
I can´t use THTTP component because it doesn´t authentication method. The indy 9 has it.
LVL 16

Expert Comment

by:George Tokas
ID: 13457888
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...


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses
Course of the Month9 days, 21 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question