Hello newsgroup
I'm using a library to discover UPnP devices on the network via sockets.
Its use is pretty straightforward:
private void Discover()
DevDiscovery disco = new DevDiscovery ();
disco.OnAddedDevice += new DevDiscovery.DiscoveryHandler(OnAdded);
disco.Start();
}
This code works always, when placed within a main-method market with a
[STAThread]-attribute (console app or winform). I'm quite sure it works
always with this code within a windows form if I'm using Invoke():
protected override void OnHandleCreated(EventArgs e)
{
Invoke(new MethodInvoker(Discover));
}
But is does *not* work always, if I'm starting the discovery from within
a windows form control! Sometimes, the event handlers are being called,
sometimes not. I guess, it's about the threading model, but I have no
clue how to solve it...
Thanks for your advice
Philipp