public override void Run() { Logger.Log("AcceptThread Run"); BluetoothSocket socket = null; while (true) { try { socket = serverSocket.Accept(); } catch (IOException e) { Logger.Log("Socket's accept() method failed " + e.Message); break; } if (socket == null) { continue; } // connection accepted service.ManageConnectedSocket(socket); serverSocket.Close(); break; } }
public override void Run() { Logger.Log("ConnectThread Run"); BtAdapter.CancelDiscovery(); try { socket.Connect(); } catch (IOException e) { CloseSocket(); return; } service.ManageConnectedSocket(socket); }