Identifying CommSSL_Read timeout in RPGLE
I've read previous posts and understand the meaning of the error; however, it's a difficult error to replicate at will.
I've modified HTTPAPI to return the HTTP Response Status Code from RPGLE HTTPCMDR4.
POST example:
rc = http_url_post_raw2(...)
peRspStsCde = rc;
if peRspStsCde = 1;
peRspStsCde = 200;
endif;
if rc = 1 or rc>=200 and rc<300;
// success!
else;
printError();
//cleanup(5); Causes Escape message and then HTTP Status Code is not returned
cleanup(0);
return;
endif;
// As you can see, I've commented out "cleanup(5)" and changed it to "cleanup(0)" for the reason stated in the commented line.
Back in my calling RPGLE program, I consider codes 200 and 202 a success.
If the code is GE 400, I retry.
With CommSSL_Read timeout error, I believe rc = 0, so follows the value of my HTTP Response Status Code.
I could consider a value of 0 an error that I should do a retry on. However, I don't know if that's wise. Though a retry does not hurt, repeated retries cause the caller of my program to wait longer for a response. I'd also like to better identify the cause when the return code is 0.
How can I identify that a CommSSL_Read timeout error has occurred?
Identifying CommSSL_Read timeout in RPGLE
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: Identifying CommSSL_Read timeout in RPGLE
rc = 0 generally means that a timeout has occurred. It may be a timeout from a different part of the code, though, it might not be a read timeout specifically.
If you specifically want to identify a read timeout, you can call http_error() to get the error number. The error number constant HTTP_BRTIME will indicate a timeout during a read.
If you specifically want to identify a read timeout, you can call http_error() to get the error number. The error number constant HTTP_BRTIME will indicate a timeout during a read.