Problem sending data via the TIdHTTP client control

Giganews Newsgroups
Subject: Problem sending data via the TIdHTTP client control
Posted by:  Ian (i…@gtl.biz)
Date: Tue, 8 Jul 2008

Hello,

    I've never used the Indy TIdHTTP client control before or dealt with
HTTP stuff so please help me out here. I have a project where I need to
communicate with a piece of hardware that is normally controlled by a
webpage. My application will talk directly to the hardware using this
control. I have a test application which mimics the hardware and all seems
ok. The problem I have is when the hardware or test app isn't running. I get
as far as the "Post" command but then it waits/hangs until I reply to the
post. Not knowing much about this type of connection I am assuming this is
correct. Will there be a timeout at some point and if so can it be
configured ? Is an event fired to say the post failed ? I need to know if
the send failed so that I can buffer the command and try again after a
pre-defined period.

    I hope someone can help me or point me in the direction of some code
samples or helpful documentation.

    I'm using Indy 10 with Delphi 7

Ian

Here is my send function:

procedure TStdHTTPSocket.Send (const SendData : string) ;
var
  Stream    : TStringStream ;
  sResponse : String ;

begin
  Stream := TStringStream.Create (SendData) ;
  try
      sResponse := m_Socket.Post (m_URL, Stream) ;

  except
  end ;

  Stream.Free ;
end ;

Replies