Code example for BluetoothSocket

Methods: close, getRemoteDevice

0
		} 
	} 
 
	private synchronized void manageAcceptedConnection(BluetoothSocket sock) 
	{ 
		BluetoothDevice remoteDev = sock.getRemoteDevice();
		String remoteAdr = remoteDev.getAddress();
 
		if (!mobitradeProtocol.isSessionActive(remoteDev) && mobitradeProtocol.AreMoreSessionsAllowed())
		{ 
			mobitradeProtocol.startNewSession(sock.getRemoteDevice());
			 
			mobitradeProtocol.SetExchangeThreadForSession(remoteAdr, new ExchangeWithMobiTradeDevice(mobitradeProtocol, sock));
			mobitradeProtocol.StartExchangeThreadForSession(remoteAdr);
 
		}else 
		{ 
			try { 
				sock.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block 
				Log.e(TAG, "Trying to close a new socket for an already running session: "+e);
				e.printStackTrace();
			}