Lazarus

Programming => Networking and Web Programming => Topic started by: Serge58 on August 12, 2017, 12:22:59 am

Title: Timeout when not connecting
Post by: Serge58 on August 12, 2017, 12:22:59 am
Hello,
I am using the following to connect to my Arduino micro controller and it works perfectly.

url:='http://10.0.1.4/arduino/webserver/'
httpclient:= TFPHttpClient.Create(Nil);
  try
     html:= httpclient.Get(url);
  finally
     httpclient.Free;   

However, if the board is not connected how do I cancel the request and send a message?
Right now my program just freeze when it happens and I have to kill it manually.
is there a timeout option that I can use?

Thanks,

Title: Re: Timeout when not connecting
Post by: Phil on August 12, 2017, 12:28:05 am
is there a timeout option that I can use?

Look at source for TFpHttpClient. It has an IOTimeout property. Maybe that would work?

Title: Re: Timeout when not connecting
Post by: Serge58 on August 12, 2017, 01:11:29 am
Well the TFpHttpClient that I am using doesn't have this IOtimeout property.
I there a way I can do it with a timer?  Or as soon as it places a request it just wait for a reply?


Title: Re: Timeout when not connecting
Post by: Phil on August 12, 2017, 01:13:31 am
Well the TFpHttpClient that I am using doesn't have this IOtimeout property.

It's in FPC 3.0.2, so upgrade.
Title: Re: Timeout when not connecting
Post by: Serge58 on August 12, 2017, 04:38:26 pm
Well I upgraded to the last version, Lazarus 1.6.4 and FPC 3.0.2, and TFPHttpClient  still doesn't have a IOTimeout property.

Looking at the forum I found some notes about a opkman unit but is it relevant?
TinyPortal © 2005-2018