* * *

Author Topic: Timeout when not connecting  (Read 413 times)

Serge58

  • New member
  • *
  • Posts: 26
Timeout when not connecting
« 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,


Phil

  • Hero Member
  • *****
  • Posts: 2316
Re: Timeout when not connecting
« Reply #1 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?


Serge58

  • New member
  • *
  • Posts: 26
Re: Timeout when not connecting
« Reply #2 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?



Phil

  • Hero Member
  • *****
  • Posts: 2316
Re: Timeout when not connecting
« Reply #3 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.

Serge58

  • New member
  • *
  • Posts: 26
Re: Timeout when not connecting
« Reply #4 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?

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus