Timers and Threads

  • Thread starter Thread starter Anders Eriksson
  • Start date Start date
A

Anders Eriksson

Hello,

I have a class in which I use System.Threading.Timer. The callback function
should send a message using TCPClient. Since the Callback function is in an
another thread this doesn't work!

How do I Invoke a function in the class thread from the callback function?

The Class is not a Form class!

// Anders
--
English is not my first language
so any error, insults or strangeness
has happend during the translation.
Please correct my English so that I
may become better at it!
 
Anders said:
Hello,

I have a class in which I use System.Threading.Timer. The callback
function should send a message using TCPClient. Since the Callback
function is in an another thread this doesn't work!

You need to be more specific. Neither TcpClient nor Socket have the
kind of thread affinity that System.Windows.Forms.Control has which
would require invoking a method on a specific thread.

What "doesn't work" about using TcpClient in the callback for the Timer?

Pete
 
Back
Top