Timer never fires

I don’t know if I’m having a senior moment (most of the afternoon) or not. I’ve used hundreds of Xojo/RB timers in the last 12 years, but I can’t get this one to fire. ConTimer is supposed to time out a TCP socket connecting to an ethernet/RS485 adapter. If I enter the right port number, the program connects instantly. If I enter the wrong port, it goes into an endless loop because the timer never fires. The CommTimer action is “EZCOM.TimedOut = True”. Any thoughts would be appreciated. I have erased the timer and all the code relating to it and entered it new. I have changed variable names. There is probably something stupid I am just not seeing. Any suggestions would be most appreciated.

your code snippet refers to TimedOut… did you mean it to be EZCOM.TimedOut instead???
you said the ACTION sets EZCOM.TimedOut, but the code shown never refers to that property

My guess is CommTimer won’t fire because execution stays in the tight while loop.

But do you really need a timer for this? Just measure the time in the loop.

dim startTime As double = microseconds while not EZSck.IsConnected and not TimedOut aa = TimedOut EZSck.Poll if (Microseconds-startTime) > 2000000 then TimedOut = true wend

Will is correct. The loop is blocking the timer. Poll allows the socket to function, but not the timer.

Thank you Will and Tim. I learned something new today.

I would move the code in the while/Wend and whatever around EZsk.isconnected into a multiple timer.