Calling timer for checking Connection....where am i wrong?

Good Morning to all of you Readers :wink:

i wanted to check , if a connection to a server is good...i tried the following :slight_smile:
grafik

grafik

the Check should be every 1000 ms
anyone knows , where i went wrong ?? (Sorry , i'm new to AI2)

Tia
Stefan

Try this extension Net : Get some information about network and in clock give blocks

If net is connected then
Set label text to connected
Else
Set label text do disconnected

Oh sorry this blocks are for if is connected not if connection is good. If you want to check if connection is good then add cloudDb and give blocks to timer cloudDb get tag list and when cloudDb taglist then connection is good and when cloudDb error then connection is bad

Sorry , my fault i did'nt included the missing blocks , here they are

But that won't solve my problem : I want to check the server connection FREQUENTLY (all 1000ms)

before posting a screenshot, please change the language to English, this will help us to understand your blocks.
And make sure NO error markers on the blocks.

i tried switching back to English , unfortunately the blocks are still in German :frowning:

Why need a check every second?

the 1 Second check was just for test reasons :slight_smile: later on a Server check every XX Minutes would be enough for my needs......

You have to use the Screen.ErrorOccurred and catch error 1101 there

Also if you want to do something repeatedly, you can call Web.Get again in the Web.Got event without using a Clock...

The TimerAlwaysFires property is a boolean value. . It does not make sense to use it in the Clock.Timer event as you tried to do it... you should use the Web.Get block there...

As already suggested, use the extension...

Taifun

Hi ya ,

i tried the NET extension , with works fine for my needs :slight_smile:

Anyway , is there a way to change the colour of the text ??

For better understanding

The Text "Connected" should be in Colour green , "Disconnected" should appear in Red.

Here'e the Block

Honestly , i didn't find a solution :frowning:

Use the TextColor property of the label to set the text color

In your example you might want to use the regular if them else block to set the text and the color

From the documentation User Interface

TextColor

Specifies the label’s text color as an alpha-red-green-blue integer.

Taifun