I added ssockets now I can compile it. I have this working with the ssockets unit added: Try S:=TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/15'); except On E: ESocketError do Writeln('Could not connect to server'); end;
But when I try the version with the timeout, I always get the error. What is the proper way to get the page into a variable with the timeout method? I tried S:= C.Get('http://10.10.01.01/30000/15'); But I'm not sure that's the right way to do it, but even without the S:= I always get the EsocketError uses fphttpclient,ssockets; Var C : TFPHTTPClient; begin C:=TFPHTTPClient.Create(Nil); try try C.ConnectTimeout:=10; // Or whatever you think is good C.Get('http://10.10.01.01/30000/15'); except On E: ESocketError do Writeln('Could not connect to server'); end; finally C.Free; end; end; James -----Original Message----- From: fpc-pascal <fpc-pascal-boun...@lists.freepascal.org> On Behalf Of Michael Van Canneyt via fpc-pascal Sent: Tuesday, September 8, 2020 2:51 AM To: James Richters <ja...@productionautomation.net>; FPC-Pascal users discussions <fpc-pascal@lists.freepascal.org> Cc: Michael Van Canneyt <mich...@freepascal.org> Subject: Re: [fpc-pascal] Ethernet Relays Add the ssockets unit to your uses clause. Michael On Mon, 7 Sep 2020, James Richters via fpc-pascal wrote: > When I try to compile either of the examples below, I get Error: Identifier > not found "ESocketError" > Any ideas? > > James > > > Yes, catch the ESocketError in a try..except: > > Try > S:=TFPHTTPCLIENT.SIMPLEGET('http://10.10.01.01/30000/15'); > except > On E: ESocketError do > Writeln('Could not connect to server'); end; > >> Is there a way to change the amount of time before the timeout? > > Yes, but then you need to create an instance, i.e. the Simple* commands won't > do that for you: > > Instead, it will look like this: > > uses fphttpclient; > > Var > C : TFPHTTPClient; > > begin > C:=TFPHTTPClient.Create(Nil); > try > try > C.ConnectTimeout:=10; // Or whatever you think is good > C.Get('http://10.10.01.01/30000/15'); > except > On E: ESocketError do > Writeln('Could not connect to server'); > end; > finally > C.Free; > end; > end; > > Michael. > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal > > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal