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

Try to restart QM.
#32
Function snrs_set_excel2
Code:
Copy      Help
function str'l r
str sd tp sst sccm fl
str cab mc=Rlogin2mac(l cab)
str s
;comenzar
Http h.Connect("xxxx" "xx" "xx")
err goto error
_s.format("mac=%s&cab=%s&mod=---" mc cab)
h.PostWithTimeout(77 "/cgi-bin/cc.pl" _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)
ret
;error
s="ERROR"
out s
ret s
#33
I cannot test it.
Like some memory in QM is corrupted and it is unstable. How after restarting QM?
#34
the same.

Is your PostWithTimeout = my PostWithTimeout ?
#35
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).
#36
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.
#37
Insert out 1 before th=mac to see how many times the code is executed.
#38
186 times 1

then

Warning: There are 200 threads. QM may fail to create more threads and stop working.
1
Warning: There are 201 threads. QM may fail to create more threads and stop working.
...
#39
Don't know why it is called 186 times when you call the function 5 times.
#40
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).
#41
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.
#42
No matter.

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


Member function Http.Post2
Code:
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&email=j.smith@xxx.com".
;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
#45
Is possible to create a function to do several HttpOpenRequests in parallel and receive the responses in str array using one QM thread?
#46
Try asynchronous.
Read "Asynchronous Operation" in MSDN library.
I cannot help, too much work.
#47
I tried it but it's too complicated to me.

Can you help, please?

note: you can test using...

Macro
Code:
Copy      Help
out
Http h.Connect("quotes.nasdaq.com")
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---------"
#48
Can you convert http://69.10.233.10/KB/cpp/WinInetRunScript.aspx to QM?


Forum Jump:


Users browsing this thread: 2 Guest(s)