I am wondering if there is something that would cause a read to be very slow on a new linux server running Red Hat when the CentOS server was very fast.
p_str$:
POST /kpos/kpos_updates_allowed.php HTTP/1.1
Host: www.grsql.com
Connection: Keep-Alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 8
Accept: */*
Cache-Control: no
kmp=0995
open (hfn)"[tcp]www.myurl.com;80"; mychan=lfo
write record (mychan)p_str$
wait 1
read record record (mychan, err=*next, bsy=*next)r$
The response is:
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 04 Nov 2024 18:16:44 GMT
Content-Type: text/xml;charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/8.3.13
X-Powered-By: PleskLin
89
<?xml version="1.0"?>
<pos_store>
<snum>0995</snum>
<date>11/04/2024</date>
<time>18:16:44</time>
<on_maint>Y</on_maint>
</pos_store>
0
Since migrating to the new server the read now takes 45 - 60 seconds and it used to take 5. I am guessing this has something to do with configuration, but cannot find anything. Wondering if there is an alternative method to the open to execute the php and pull the result.
I have made a modification to the program and I believe that has resolved the time to complete issue. I believe this is all set.
I changed from:
read record (mychan,err=*next,bsy=*next)r$; rr$=r$; r_cnt++; if r_cnt<5 then goto *same
to:
read record (mychan,err=*next,bsy=*next)r$; rr$=r$; if pos("</pos_store>"=rr$)=0 then r_cnt++; if r_cnt<5 then goto same
This eliminates the need to make multiple tries if the string is read correctly initially and speeds up the result.
Hello
If you want to call a webservice, no need to re-invent the wheel with TCP socket programming
The CALL "*plus/web/request" program is an HTTP client that can send a request with HTTP headers, and return a response as a string that you can then parse using either the *obj/xml class or convert to an associative array if working with JSON. It supports all HTTP verbs GET/HEAD/POST/PUT/PATCH/DELETE and therefore allows you to interact with RESTful web APIs
My 0.02€