Error: CommTCP_read: Socket has been shut down.

Discussions related to HTTPAPI (An HTTP Client Package for RPG programming.) http://www.scottklement.com/httpapi/
Post Reply
tomh5480
Posts: 2
Joined: Fri Dec 16, 2022 1:35 pm

Error: CommTCP_read: Socket has been shut down.

Post by tomh5480 »

We're on OS v7r4

One of my programs is failing with the following error:
CommTCP_read: Socket has been shut down.

URL that I'm attempting:
http://192.168.999.998/SendEmail/SendEm ... &subj=Test

If I enter the url from a browser window, it works. When I call the url from the program on the IBM, it fails with the error msg.

Here's a code snip:
URL = 'http://' + %trim(server) + %trim(ASP) +
'?' + %trim(data);
rc = http_url_get_raw(%trim(URL): *loval: %paddr('INCOMING'):30);


Here's the debug log info:

HTTPAPI Ver 1.45 released 2021-09-20
NTLM Ver 1.4.0 released 2014-12-22
OS/400 Ver V7R4M0

http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 2
DNS resolver retry : 2
DNS resolver options: x'00000136'
DNS default domain: domain_name
DNS server found: 192.168.999.999
Nagle's algorithm (TCP_NODELAY) disabled.
http_persist_get(): entered
http_persist_req(GET) entered.
http_persist_req(GET) entered.
http_long_ParseURL(): entered
http_long_ParseURL(): entered
do_oper(GET): entered
There are 0 cookies in the cache
GET /SendEmail/SendEmail.aspx?from=tom@myserver.com&to=tom@myserver.com&msg=Test&subj=Test
HTTP/1.1
Host: 192.168.999.998
User-Agent: http-api/1.45


recvresp(): entered
SetError() #44: CommTCP_read: Socket has been shut down.
recvresp(): end with err
http_close(): entered
Scott Klement
Site Admin
Posts: 635
Joined: Sun Jul 04, 2021 5:12 am

Re: Error: CommTCP_read: Socket has been shut down.

Post by Scott Klement »

I assume you changed the IP addresses in the log -- since they are nonsensical and invalid.

The error indicates an error reading from the network. Typically it means that the OS said there was data to read from the socket, but then when it requested the data, it got none.

This can happen with SSL sockets because some of the bytes from the network are used to handle the cryptography, so aren't actually data. Current versions of HTTPAPI understand this and will re-try.

But, this appears to be a TCP (non-SSL) socket from what you've posted. I've not heard of that happening... My guess is that there is some sort of network error, but I don't know what, specifically... never seen it before.
tomh5480
Posts: 2
Joined: Fri Dec 16, 2022 1:35 pm

Re: Error: CommTCP_read: Socket has been shut down.

Post by tomh5480 »

I did obfuscate the IP addresses, company policy.

So I'm thinking I'm not all the way current on httpapi - if I install the most-recent version, will I need to recompile my programs that are compiled with the httpapi headers?

Thanks
Scott Klement
Site Admin
Posts: 635
Joined: Sun Jul 04, 2021 5:12 am

Re: Error: CommTCP_read: Socket has been shut down.

Post by Scott Klement »

No, you don't have to recompile your programs.
Post Reply