Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HTTP persistent connection
What is code that calls PostWithTimeout 5 times?

Try to restart QM.
Function snrs_set_excel2
Copy      Help
function str'l r
str sd tp sst sccm fl
str cab mc=Rlogin2mac(l cab)
str s
Http h.Connect("xxxx" "xx" "xx")
err goto error
_s.format("mac=%s&cab=%s&mod=---" mc cab)
h.PostWithTimeout(77 "/cgi-bin/" _s s)
err goto comenzar
if(!s.len) goto comenzar

snrs_extraer s sd tp sst sccm fl
ExcelSheet es.Init
es.SetCell(sd 10 r)
es.SetCell(tp 11 r)
es.SetCell(sst 12 r)
es.SetCell(sccm 13 r)
es.SetCell(fl 14 r)
out s
ret s
I cannot test it.
Like some memory in QM is corrupted and it is unstable. How after restarting QM?
the same.

Is your PostWithTimeout = my PostWithTimeout ?
Yes, I tested your version. No errors.
How much threads is in the Running Items list when you get the 1000 threads error?
Where exactly is the exception? (if in code).
in the Running Items list:11 threads.

QM didn't stop.
Error: Failed to create thread __Http_PostWithTimeout. Max 1000 threads allowed.

I had to end threads manually.
Insert out 1 before th=mac to see how many times the code is executed.
186 times 1


Warning: There are 200 threads. QM may fail to create more threads and stop working.
Warning: There are 201 threads. QM may fail to create more threads and stop working.
Don't know why it is called 186 times when you call the function 5 times.
maybe because the function Rlogin2mac extract data of excel using PostWithTimeout too (but used Post and the same).

I don't know why works with PostWithTimeout (without line) and not with PostWithTimeout (with line).
Maybe worked without the line because was slower.

Mybe this will help:
QM limits the number of threads launched within several seconds, not necessary all running simultaneously.
No matter.

I will seek another way.
Try InternetSetOption with (copy of) Http.Post.
with Post2 (without InternetSetOption) works; (with InternetSetOption) in the Running Items list:11 threads but don't finish.

Member function Http.Post2
Copy      Help
function# $action $data [str&responsepage] [$headers] [inetflags] [str&responseheaders]

;Posts web form data. Returns 1 on success, 0 on failure.
;This function cannot post files. To post files use PostFormData.

;data - urlencoded string, eg "name=John+Smith&".
;action, responsepage, headers, inetflags, responseheaders - the same as with PostFormData.

;See also: <Http.PostFormData>.

lpstr sh="Content-Type: application/x-www-form-urlencoded"
if(empty(headers)) headers=sh
else if(findrx(headers "(?i)^Content-Type *:" 8)<0) headers=_s.from(sh "[]" headers)

__HInternet hi=HttpOpenRequest(m_hi "POST" action 0 0 0 INTERNET_FLAG_RELOAD|inetflags 0); if(!hi) ret Error
int option(5) optionlen(4); if(!InternetSetOption(m_hi INTERNET_OPTION_MAX_CONNS_PER_SERVER &option &optionlen)) ret Error
if(!HttpSendRequest(hi headers -1 data len(data))) ret Error

if(&responseheaders and !GetResponseHeaders(hi responseheaders)) ret Error

if(&responsepage) ret Read(hi responsepage)
ret 1
Is possible to create a function to do several HttpOpenRequests in parallel and receive the responses in str array using one QM thread?
Try asynchronous.
Read "Asynchronous Operation" in MSDN library.
I cannot help, too much work.
I tried it but it's too complicated to me.

Can you help, please?

note: you can test using...

Copy      Help
Http h.Connect("")
str s s1 s2 s3 s4 s5 s6 s7 s8 s9
h.Post("/asp/SummaryQuote.asp" "symbol=PONE&selected=PONE" s)
out s
out "0---------"
h.Post("/asp/SummaryQuote.asp" "symbol=GENE&selected=GENE" s1)
out s1
out "1---------"
h.Post("/asp/SummaryQuote.asp" "symbol=STSA&selected=STSA" s2)
out s2
out "2---------"
h.Post("/asp/SummaryQuote.asp" "symbol=UCBH&selected=UCBH" s3)
out s3
out "3---------"
h.Post("/asp/SummaryQuote.asp" "symbol=RCRC&selected=RCRC" s4)
out s4
out "4---------"
h.Post("/asp/SummaryQuote.asp" "symbol=FITB&selected=FITB" s5)
out s5
out "5---------"
h.Post("/asp/SummaryQuote.asp" "symbol=PENX&selected=PENX" s6)
out s6
out "6---------"
h.Post("/asp/SummaryQuote.asp" "symbol=BRID&selected=BRID" s7)
out s7
out "7---------"
h.Post("/asp/SummaryQuote.asp" "symbol=STRS&selected=STRS" s8)
out s8
out "8---------"
h.Post("/asp/SummaryQuote.asp" "symbol=APWR&selected=APWR" s9)
out s9
out "9---------"
Can you convert to QM?

Forum Jump:

Users browsing this thread: 1 Guest(s)