[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: How to catch a "SetError() #6: connect(): A remote host refused an attempted connect operation" problem
- From: "Helge Bichel" <hbi@xxxxxxx>
- To: "'HTTPAPI and FTPAPI Projects'" <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
- Subject: RE: How to catch a "SetError() #6: connect(): A remote host refused an attempted connect operation" problem
- Date: Fri, 4 May 2012 13:34:49 +0200
Hi Ronnie.
Nice example on HTTPAPI timeout.
Just a comment on your nice /free code:
you could replace the qcmdexc dlyjob by
h bnddir('QC2LE')
d sleep pr 10u 0 extproc('sleep')
d secs 10u 0 value
sleep(30);
then your code is really free.
Brgds
Helge
-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Ronnie
Sent: Friday, May 04, 2012 12:29 PM
To: HTTPAPI and FTPAPI Projects
Subject: RE: How to catch a "SetError() #6: connect(): A remote host refused an attempted connect operation" problem
Hi Rick.
This is what I use.
dow (wTimeoutretries <= Timeoutretries);
//set number of retries to something like 3 or 4 or however
// many tries you are prepared to make for a timeout only.
// Other errors will generate appropriate error.
rc = http_url_post_xml(
'http://' + %trim(Server)
+'/EnterpriseNativeDataService.svc'
: %addr(SOAP) + 2
: %len(SOAP)
: *NULL
: %paddr(Incoming)
: %addr(PartRetrieve)
: timeout
: HTTP_USERAGENT
: 'application/soap+xml'
: SoapAction);
if (rc <> 1);
PartRetrieve.Error = '99: HTTP';
PartRetrieve.ErrorMsg = http_error;
if (PartRetrieve.ErrorMsg = 'CommTCP_read: time-out!');
wTimeoutretries = wTimeoutretries + 1;
if Wtimeoutretries <= Timeoutretries;
PartRetrieve.Error = '00: ';
PartRetrieve.ErrorMsg = *blanks;
endif;
// delay the job to give server time to recover
wcmd = 'DLYJOB DLY(30) ';
wcmdlen = %len(wcmd);
// I have put the call in here in fixed but you can
// prototype it to make the call better to QCMDEXC
/END-FREE
c call(e) 'QCMDEXC'
c parm wcmd
c parm wcmdlen
/FREE
else;
// After x number of retries pass the error to the calling
// program it needs to do something with it.
if http_error = *blanks;
PartRetrieve.Error = '99: HTTP';
PartRetrieve.ErrorMsg = 'Unknown HTTP error';
else;
PartRetrieve.Error = '99: HTTP';
PartRetrieve.ErrorMsg = http_error;
ENDIF;
wTimeoutretries = wTimeoutretries + 1;
if dind <> 'Y';
// turn on your debug indoicator to get more detail for
// the connection failure on the retry
// I use a dataarea called debug to set indicator so I
// can change it on the fly.
in *lock debug;
dind = 'Y';
out debug;
ENDIF;
endif;
else;
wTimeoutretries = Timeoutretries + 1;
endif;
enddo;
Ronnie Visser
-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Rick Bovet
Sent: Friday, May 04, 2012 12:07 PM
To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Subject: How to catch a "SetError() #6: connect(): A remote host refused an attempted connect operation" problem
Hi All,
We are using HTTPAPI to call a remote service. But for some reason, the other party server is down. But we want to keep our
application running and have made provisions if the data from that service is not provided. However the connect() functions "hangs"
for approx 2 minutes before the "SetError() #6: connect(): A remote host refused an attempted connect operation" is returned. This
long duration is causing a 500 error in our web-application.
I understand that this is not a HTTPAPI problem from the archives. But I like to get around this. Is there any way that I can test
whether the remote host is available ?
I have set a timeout of 1 sec in the post. I also tried using the http_set_100_timeout() API prior to the post. But at no effect. We
are using HTTPAPI version 1.23
Met vriendelijke groet / Kind regards,
Rick Bovet
Development Manager
P please observe the new direct dial below
[cid:image001.png@01CD29ED.A31B3670]
ECi Software Solutions
Siriusdreef 66, 2132 WT Hoofddorp
Postbus 3005, 2130 KA Hoofddorp
Netherlands
Tel. +31 (0)23-555 49 49
Fax +31 (0)23-562 58 48
Direct dial: +31 (0)23-564 98 55
rbovet@xxxxxxxxxxxxxxxx<mailto:jenaam@xxxxxxxxxxxxxxxx>
www.eci.eu<http://www.eci.eu> & www.easyorder.eu<http://www.easyorder.eu>
ECi Software Solutions is a division of eCommerce Industries, Inc www.ecisolutions.com<http://www.ecisolutions.com>
P please consider the environment before printing this e-mail
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------