is "load url" TCP or UDP? also tsNet

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Monox18
Posts: 118
Joined: Tue Nov 25, 2014 9:48 pm
Location: Deggendorf, Germany

is "load url" TCP or UDP? also tsNet

Post by Monox18 » Wed May 20, 2020 3:44 pm

I can see load url is asynchronous but I can't tell if it is UDP or TCP. Same question for the tsNet library, which I hope to try out soon. Are the commands TCP or UDP? I'm supposing they are probably TCP
Monox
Developing a Cyber Physical System.
https://www.monoxware.com/

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: is "load url" TCP or UDP? also tsNet

Post by FourthWorld » Wed May 20, 2020 4:16 pm

Monox18 wrote:
Wed May 20, 2020 3:44 pm
I can see load url is asynchronous but I can't tell if it is UDP or TCP.
TCP.
Same question for the tsNet library, which I hope to try out soon. Are the commands TCP or UDP? I'm supposing they are probably TCP
tsNet covers a wide range of functionality. Most of it is TCP, there may be some UDP operations in there too. Any that use UDP will be clearly noted as such in the documentation.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Monox18
Posts: 118
Joined: Tue Nov 25, 2014 9:48 pm
Location: Deggendorf, Germany

Re: is "load url" TCP or UDP? also tsNet

Post by Monox18 » Wed May 20, 2020 6:20 pm

Got it. Thank you!
Monox
Developing a Cyber Physical System.
https://www.monoxware.com/

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: is "load url" TCP or UDP? also tsNet

Post by FourthWorld » Wed May 20, 2020 7:58 pm

Glad that helped. But now you've got me curious: are you using UDP in your app? If so, for what functionality?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Monox18
Posts: 118
Joined: Tue Nov 25, 2014 9:48 pm
Location: Deggendorf, Germany

Re: is "load url" TCP or UDP? also tsNet

Post by Monox18 » Wed May 20, 2020 8:13 pm

I'm building a SCADA for a machine. I have a local server reading and writing data to the PLC controlling the machine. LiveCode is used for the client App. So the app is all about networking. Calling and consuming REST services.

The problem began when I was originally using "put url into" to load the data. It was very slow. I tested times, but forgot the exact numbers. Around 120ms in a LAN.

Then I discovered "load url into". This one is async. I also improved the slow processing of my code. Now it takes 10ms asyn data download and 20ms painting the GUI (blocking handler). I'm updating the GUI every 200ms, leaving 180ms free to deal with responsivenes, which is fine. This now feels much better. However this is in a LAN. I don't know how much slower it will become once it is in the cloud.

Although I'm happy with the current results, a friend explained me a bit of the OSI model and what is TCP/UDP. I don't have networking background at all. So, apparently UDP is used to send data periodically in which it is ok to loss a few packages. Since I'm reading the data periodically, that's fine.

So I wanted to test UDP connections to make it even faster, and make sure it works well once I put the app in the cloud. Haven't tested tsNet yet, but it looks very promising.
Monox
Developing a Cyber Physical System.
https://www.monoxware.com/

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: is "load url" TCP or UDP? also tsNet

Post by FourthWorld » Wed May 20, 2020 10:08 pm

Thanks for describing that. I'm glad I asked, that sounds like a cool project.

Keep us posted if we can provide any other help.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

mrcoollion
Posts: 719
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: is "load url" TCP or UDP? also tsNet

Post by mrcoollion » Thu May 21, 2020 9:05 am

More information about tsNet here: https://www.techstrategies.com.au/tsnet ... -external/

The tsNet LiveCode External utilizes the libcurl (https://curl.haxx.se/), libssh2 (https://www.libssh2.org/) and OpenSSL (https://www.openssl.org/) libraries to provide its feature set. The lubcurl lib is solely based on TCP. The libssh2 and OpenSSL libs i think can utilize UDP (e.g. for streaming video) . I do not know and cannot find how to force UDP or TCP transmissions with tsNet. Maybe you could ask techstrategies.com ?

I have been working with tsNet in my current application for retrieving stock data and tsNet works really well, you should test it in your situation. Also test the difference in synchronous and asynchronous transfer modes. Might make a big difference in time.

Regards,

Paul

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: is "load url" TCP or UDP? also tsNet

Post by bangkok » Thu May 21, 2020 10:20 am

Speaking about tsNet...

Do you know that LC 9.6 (rc2 now) is shipped with tsNet 1.40 (if you check, LC 9.5.1 came with version 1.39, and LC 8.1.0 with 1.35)

And tsNet 1.40 brings a truckload of new parameters.

An example here, with the command tsNetUploadFile...

https://www.techstrategies.com.au/tsnet ... UploadFile

It's something that should deserve more awareness, and more... examples and tests (personally, i do not have the slightest idea on how to use many of those new exciting parameters :) ).

Monox18
Posts: 118
Joined: Tue Nov 25, 2014 9:48 pm
Location: Deggendorf, Germany

Re: is "load url" TCP or UDP? also tsNet

Post by Monox18 » Thu May 21, 2020 2:21 pm

Indeed version 1.40 brings a bazillion options. With that huge amount of customization and both Sync/Async support, I have the feeling that tsNet will be enough to accomplish what I want. Soon I will discover it once I test it with the machine in the cloud. Tnx for the resources Paul, they help me to understand better how tsNet works.

For sure will ask more questions as I continue developing.
Monox
Developing a Cyber Physical System.
https://www.monoxware.com/

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: is "load url" TCP or UDP? also tsNet

Post by FourthWorld » Thu May 21, 2020 5:30 pm

cURL is a great foundation, a de facto industry standard. As much as I admire Charles' work with wrapping it in tsNet, limiting it to proprietary editions leaves LC among the very few open source languages has that no cURL wrapper.

Maybe one of us will find enough time to use LCB to wrap cURL for the vast majority of LC users enjoying the Community Edition.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: is "load url" TCP or UDP? also tsNet

Post by mwieder » Fri May 22, 2020 4:36 am

Why bother with cURL when httpie is available?

https://httpie.org/

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: is "load url" TCP or UDP? also tsNet

Post by FourthWorld » Fri May 22, 2020 6:01 am

mwieder wrote:
Fri May 22, 2020 4:36 am
Why bother with cURL when httpie is available?

https://httpie.org/
Hmmm....command line...suitable license...I like it! Anyone here have time to write a wrapper lib for that?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

mrcoollion
Posts: 719
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: is "load url" TCP or UDP? also tsNet

Post by mrcoollion » Fri May 22, 2020 2:50 pm

Looks nice but only support for Linux, macOS and Windows, NO Android :( .

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: is "load url" TCP or UDP? also tsNet

Post by mwieder » Fri May 22, 2020 4:18 pm

Richard- I think the wrapper you're looking for is called "shell". :P

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: is "load url" TCP or UDP? also tsNet

Post by FourthWorld » Fri May 22, 2020 5:59 pm

mwieder wrote:
Fri May 22, 2020 4:18 pm
Richard- I think the wrapper you're looking for is called "shell". :P
If the syntax is straightfoward enough that'll work. Concatenation can sometimes be cumbersome, so if I need to use it I may still want a few wrappers for some things. But very good to know about httpie - thanks for that. Nice to have a solution for deeper URL handling for the vast majority of LC users running the Community Edition.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”