Title: Message

Quick update. I wrote a stand-alone application to see if I could reproduce this and sure enough I have the same problem. What I did differently is display the E.Message (where E is the Exception). It turns out that the Post method is failing with the following exception message:

 

IOHandler value is not valid.

 

BTW – I have a TIdSSLIOHandlerSocket component on the form too, because my URL starts with https.

 

I have also found the Indy knowledgebase online and I am looking for answers. But the clock is ticking and my boss is starting to get antsy.

 

Any help to speed up this process would be greatly appreciated.

 

Eric

 

Eric Tishler

Software Architect

Resolute Partners, LLC

Phone: 203.271.1122

Fax: 203.271.1460

[EMAIL PROTECTED]

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Eric Tishler
Sent: Monday, June 07, 2004 8:33 AM
To: NZ Borland Developers Group - Delphi List
Subject: [DUG] Trying to use indy HTTP with intermittent success

 

I have an application that must communicate with a server via the Internet using HTTP. (I have no choice in this). Using the Indy TIdHTTP component I perform the following:

 

Function CommViaHTTP(PostData : string) : boolean;

var

  Source: TStringList;

  Response: TStringStream;

  strTemp : String;

begin

  HTTP.ProxyParams.ProxyServer := '';

  HTTP.ProxyParams.ProxyPort := 80;

  HTTP.Request.ContentType := 'application/x-www-form-urlencoded';

 

  Response := TStringStream.Create('');

  try

    Source := TStringList.Create;

    try

     Source.Add(PostData);

     try

       strTemp := MainForm.AppSettings.StoredValues.StoredValue['WebSiteUrl'];

       HTTP.Post(strTemp, Source, Response);

     except

      DebugLog('Server Response: ' + Response.DataString);

      Result := False;

      Exit;

     end;

 

     DebugLog('Data posted to the Server: ' + PostData);

     DebugLog('Server Responded with: ' + Response.DataString);

 

    finally

     Source.Free;

    end;

  finally

    Response.Free;

  end;

end;

 

I pulled this code from another module I am maintaining and it works every time. When I first copied the code over to this new module I tested it and never got a response from the server. I spent several hours in the office this weekend trying to find my problem, and to get this to work for me in my code (as presented above). The thing is it seems to work occasionally. That is over a 4 hour testing period yesterday, I actually got a response back from the server after the HTTP.Post method was called. It worked twice, but failed about 10 times. *arggh*

 

The code in the original module is essentially the same, but works perfectly every time.

 

Can anyone see what it is that I might be doing wrong here? I am a beginner with Indy and HHPT via application programming. Although I have a decade of hardcore sockets experience under my belt.

 

Help!

 

Eric

 

Eric Tishler

Software Architect

Resolute Partners, LLC

Phone: 203.271.1122

Fax: 203.271.1460

[EMAIL PROTECTED]

 

_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to