U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ MT-multithreading and servers » SOLVED HttpRequest: is it possible to not wait the server answer?
Re: HttpRequest: is it possible to not wait the server answer? [message #60088 is a reply to message #60084] Sat, 12 August 2023 11:12 Go to previous message
forlano is currently offline  forlano
Messages: 1244
Registered: March 2006
Location: Italy
Senior Contributor
I solved the problem. In the meantime I learned that HttpRequest(), it seems, must wait an answer.

The solution is let the script (on the server) send back the wanted answer to the client, then continue the job on the server. The termining answer must be done properly. In PHP this is done in this way ( reference :https:// stackoverflow.com/questions/15273570/continue-processing-php -after-sending-http-response/15273676#15273676 )

ob_start();
// do initial processing here
echo $response; // send the response to the client
header('Connection: close');
header('Content-Length: '.ob_get_length());
ob_end_flush();
ob_flush();
flush();

//... continue other stuff
//...


These two lines are very important and do the job:
header('Connection: close');
header('Content-Length: '.ob_get_length());
without them the client still hang.

Luigi

[Updated on: Sat, 12 August 2023 11:15]

Report message to a moderator

 
Read Message
Read Message
Previous Topic: HttpRequest - desktop client U++ (accessing java tomcat server)
Next Topic: HttpRequest::GetPath() [FEATURE REQUEST]
Goto Forum:
  


Current Time: Tue Sep 15 16:37:20 GMT+2 2026

Total time taken to generate the page: 0.00573 seconds