[fpc-pascal] Ethernet Relays
James Richters
james at productionautomation.net
Tue Sep 8 19:59:15 CEST 2020
Yes 10 was too short, I made it larger and larger until it worked. 1000 was the lowest value that worked so I set it to 2000, that's still quite a bit faster than the default.
If I make a mistake in the link but the server IP address is correct, I get a valid connection but then it fails and terminates with:
An unhandled exception occurred at $0000000100017675:
EHTTPClient: Unexpected response status code: 401
If I use the wrong IP address, but that IP address has a different server running on it, but that page is not available, I get:
An unhandled exception occurred at $0000000100017675:
EHTTPClient: Unexpected response status code: 401
Is there a way to obtain these errors as well so it doesn't terminate my program?
James
-----Original Message-----
From: fpc-pascal <fpc-pascal-bounces at lists.freepascal.org> On Behalf Of Michael Van Canneyt via fpc-pascal
Sent: Tuesday, September 8, 2020 7:44 AM
To: James Richters <james at productionautomation.net>; FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
Cc: Michael Van Canneyt <michael at freepascal.org>
Subject: Re: [fpc-pascal] Ethernet Relays
On Tue, 8 Sep 2020, James Richters via fpc-pascal wrote:
> 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
What timeout did you use ? 10 ms is probably too short.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal at lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list