tsNetPost is asynchronous. Is the callback blocking?

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Posts: 946
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy

tsNetPost is asynchronous. Is the callback blocking?

Post by trevix » Tue Feb 06, 2024 11:26 am

In my standalone, inside a loop, I do more than one tsNetPost to Azure at a time, while the app does other things that must not be blocked by a "post".
In order to not confuse the Azure WebApp, inside the loop I set a "wait for Flag" after each tsNetPost command.
Something like this:

Code: Select all

repeat xxx
    put false into sWebUploadDone --flag
    put tsNetPost(pID,tURL,tHeaders,tServerString,"postResponse") into tError
    wait until sWebUploadDone with messages
end repeat

on postResponse pID, pStatus, pBytes, pResult
    put true into sWebUploadDone
    --handle errors and returned data
end postResponse
It seems to be working but haven't tested it with big numbers.
So, while tsNetPost is not blocking, is the call back script also not blocking?
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

Posts: 2550
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: tsNetPost is asynchronous. Is the callback blocking?

Post by stam » Wed Feb 07, 2024 11:19 pm

Honestly couldn't say for sure but suspect that's up to your code. Pretty sure the callback isn't blocking or non-blocking by default...
If you find your code is blocking and can't solve it (eg by adding something like 'wait 0 with messages' inside loops), you can always post it here.

Post Reply

Return to “Internet”