I turn on AutoDiscovery when my application starts. Whenever I want to communicate with a device I temporarily turn off AutoDiscovery (by setting AutoDiscovery = False). This works most of the time but sometimes it hangs the application. I now do some checks for DiscoveryPending before turning it off but that doesn't help.
I do my testing on an HP iPAQ hx2190 (Windows Mobile 5.0) with Widcomm stack (hw: 2.12, sw: 188.8.131.520).
Any ideas how to proceed? Can I do it some other way?
Code: Select all
Dim iTries As Integer = 0 While nwork.DiscoveryPending And (iTries < 10) Threading.Thread.Sleep(1000) Application.DoEvents() iTries = iTries + 1 End While If iTries >= 10 Then Try nwork.CancelDeviceDiscovery() Catch ex As Exception End Try End If nwork.AutoDiscovery = False