Quantcast
Channel: 32feet.NET
Viewing all articles
Browse latest Browse all 469

Closed Issue: Maximum 2 concurrent socket.Connect() calls MS CE.NET [33791]

$
0
0
While testing multiple device connections and reconnections under Windows Mobile 6.5 i've come across an undocumented feature of the bluetooth sockets.

I can only call the socket.Connect(adr,guid) function twice concurrently. Any more and the 3rd + call never returns and wont allow reconnection to that end-point until the application is restarted.

__Test)__
In four seperate threads;
Create new BluetoothClient()'s
SetPin to my passphrase
call .Connect(address, serialport)

If each device is on and in-range, all connect ok.

If I then disconnect all devices by closing their sockets, and turn the devices off;

Create four new threads and Clients again.
Let them all fail one attempt to Connect()
Retry a Connect() on each client in separate threads.

Device 1 and 2 connect and continue trying ok,
Device 3 and 4 hang on the connect() call and never reconnect properly again.

If I then have an eternal timeout monitor on the Connect call, and on >30second Connect() call close the client, it gives a socket exception saying WSABlockingBlahhblahClosed and then none of the sockets every connect again.. until I restart the application.

it appears the first two connection attempts are ok, and the 3rd onwards hang forever in the Connect() call, never return, and I cannot force them to clean up and reconnect.

In the above instance, if I do not turn on the remote devices and let the clients attempt connections, I get the same result, no connections at all. Its as if, if the connection fails and you try now for another concurrent connection, everything goes to crap.


__Solution)__
I've now placed a semaphore around the Connect() statements allowing only two active connections attempts at once.

I experiance no other issues with multiple devices once they're all connected.

Viewing all articles
Browse latest Browse all 469

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>