I’am new with Xojo and I wonder how I, in a console application, I can use a TCP socket inside a TimerAction method when the TCP object was declared inside the App Run Event.
When the Run event handler of the app completes, any variable declared within it will die. So if you want those variables to exist for the Timer event handler, they must be made external to that method - the simplest way is to make them properties of the application. In that case, don’t declare them in the Run event handler.
A property declared for the app must still be initialised, so you still need:
Even methods called from within the Run event won’t be able to access variables declared within the event.
For this, you can either pass the variable as a parameter, or declare the parameter as a property of the surrounding class instead.