Is there a callback example for TcpListen? I don't see a way to create a
trigger in .Net that would listen for socket requests and then trigger my
acceptConnection (thsClient) method. BTW .. I am checking pending so that I
can stop the thread and switch ports to listen to if needed. Otherwise, I'd
be happy to just use listen.Accept ... which blocks.
Presently I have:
bool bRun = true;
private void ListenThread ()
{
TcpListen listen = new TcpListen (localAddr, 5051);
listen.Start ();
while (bRun)
{
if (listen.Pending ())
{
TcpClient thsClient = listen.AcceptTcpClient ();
acceptConnection (thsClient);
}
}
listen.stop ();
}