On 1/28/2013 05:47, Michael Schnell wrote:
I tried to reproduce this with a more simple project, just accessing a non-existing IP address, but I found that while on Windows here Synapse issues a time out (after some seconds, exactly like when the Heating Controller fails to answer), when compiling for Linux (PC and ARM) the error message is "HR_Error: 113,No route to host" and is issued immediately and thus not involves a timeout (and no hanging on ARM).
i'm trying to make sure i'm following along here because i'm also using synapse for a project...
using a "slightly modified" testhttp (that came with synapse, attached) and attempting to connect via http to a non-existant IP in my network, i get a 0 result code, empty result string and "Connection reset by peer" string on my winwhatever box but that may be due to a firewall proxy that is injected into all http streams on that winwhatever system... on my os/2 eCS2 box, i get 500 result code, empty result string and "Connection refused" string... however, if i try using a non-existent hostname, both return 500 result code, empty result string and "Host not found" string...
i would suggest that trying to use a non-existent IP or host is not the way you want to go to test this... the results are not going to be what you should be getting from the heating controller connection when it fails...
your "No route to host" actually sounds plausible if there is, in fact, no route to the IP you have chosen... that also sounds like there's no default routing gateway defined for networking traffic headed out of the local network... when i test trying to access a non-existent IP outside my local network, my winwhatever box reports "Connection reset by peer" (as above) and my OS/2 eCS2 box reports "Connection timed out"...
suffice it to say that synapse's error codes are not always they seem to be, unfortunately... run testhttp and you'll see what i mean... i'm pretty sure there are other result codes and strings that i've not been told about or discovered yet... oh, and yes, this testhttp will use ssl libraries if they exist so you can test against https as well as http ;)
EG: testhttp http://google.com/ 301 Moved Permanently "ssl_openssl" "OpenSSL 0.9.8o 01 Jun 2010" "" "" "" HTTP/1.0 301 Moved Permanently Location: http://www.google.com/ Content-Type: text/html; charset=UTF-8 Date: Mon, 28 Jan 2013 19:00:49 GMT Expires: Wed, 27 Feb 2013 19:00:49 GMT Cache-Control: public, max-age=2592000 Server: gws Content-Length: 219 X-XSS-Protection: 1; mode=block X-Frame-Options: SAMEORIGIN Connection: Keep-Alive testhttp https://google.com/ 301 Moved Permanently "ssl_openssl" "OpenSSL 0.9.8o 01 Jun 2010" "" "" "" HTTP/1.0 301 Moved Permanently Location: https://www.google.com/ Content-Type: text/html; charset=UTF-8 Date: Mon, 28 Jan 2013 19:01:35 GMT Expires: Wed, 27 Feb 2013 19:01:35 GMT Cache-Control: public, max-age=2592000 Server: gws Content-Length: 220 X-XSS-Protection: 1; mode=block X-Frame-Options: SAMEORIGIN Connection: Keep-Alive
{$MODE DELPHI} Program testhttp; uses httpsend, classes, ssl_openssl; var HTTP: THTTPSend; l: tstringlist; begin HTTP := THTTPSend.Create; l := TStringList.create; try if not HTTP.HTTPMethod('GET', Paramstr(1)) then begin writeln('ERROR'); writeln(Http.Resultcode,' "',Http.Resultstring,'"'); writeln('"',Http.Sock.SSL.LibName,'" "',Http.Sock.SSL.LibVersion,'"'); writeln('"',Http.Sock.GetErrorDescEx,'"'); writeln('"',Http.Sock.LastErrorDesc,'"'); writeln('"',Http.Sock.SSL.LastErrorDesc,'"'); end else begin writeln(Http.Resultcode, ' ', Http.Resultstring); writeln('"',Http.Sock.SSL.LibName,'" "',Http.Sock.SSL.LibVersion,'"'); writeln('"',Http.Sock.GetErrorDescEx,'"'); writeln('"',Http.Sock.LastErrorDesc,'"'); writeln('"',Http.Sock.SSL.LastErrorDesc,'"'); writeln; writeln(Http.headers.text); writeln; l.loadfromstream(Http.Document); // writeln(l.text); end; finally HTTP.Free; l.free; end; end.
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel