蓝牙socket通信 收不到数据 各位大侠看看这报的错是啥意思……

解决方案 »

  1.   

    直接发LogCat里面的信息上来就好了。
      

  2.   

    哎……插不进去图片…………只好手动输入了~~~java.io.IOexception  software caused connection abort
    at android.bluetooth.bluetoothsocket.readnative(Ntive Method)
    at android.bluetooth.bluetoothsocket.read(bluetoothsocket. java:307)
    at android.bluetooth.bluetoothInputStream.read(bluetoothInputStream. java:96)
    at java.io.inputStream.read(InputStream. java:157)
    at com.card.mango.receivecard$AceptThread.run(receivecard java:103)
    No keyboard for id 65536
    using default keymap :system/user/keychars/qwerty.kcm,bin终于输完了 看在我这么辛苦的份上 大家帮我看看吧……
    源代码如下private class AcceptThread extends Thread {
        private final BluetoothServerSocket mmServerSocket;
        private InputStream mmInStream;
     
        public AcceptThread() {
            // Use a temporary object that is later assigned to mmServerSocket,
            // because mmServerSocket is final
            final String SPP_UUID = "00001101-0000-1000-8000-00805F9B34FB";   
            UUID uuid = UUID.fromString(SPP_UUID); 
            BluetoothServerSocket tmp = null;
            try {
                // MY_UUID is the app's UUID string, also used by the client code
                tmp = mBluetoothAdapter.listenUsingRfcommWithServiceRecord(Name,uuid);
            } catch (IOException e) { }
            mmServerSocket = tmp;
        }
     
        public void run() {
            BluetoothSocket socket = null;
            // Keep listening until exception occurs or a socket is returned
            while (true) {
                try {
                    socket = mmServerSocket.accept();               
                } catch (IOException e) {
                    break;
                }
                // If a connection was accepted
                if (socket != null) {
                    try {
      
                     System.out.println("接收到socket:"+socket);
                     //manage the connection , begin to exchange stream   
                    
                     mmInStream = socket.getInputStream();
                     System.out.println("接收到stream:"+mmInStream);
                    
                        byte[] buffer = new byte[1024];
                     int temp = 0;
                     while((temp = mmInStream.read(buffer)) != -1) {
                    
                     System.out.println(new String(buffer,0,temp));  
                     }
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
                    finally{
                     cancel();
                    }
                }   
            }
        }
     
        /** Will cancel the listening socket, and cause the thread to finish */
        public void cancel() {
            try {
             mmServerSocket.close();
            } catch (IOException e) { }
        }
    }
      

  3.   

    发完整的LogCat信息来上,直接复制就好了,你还手输?
      

  4.   

    对了~~ 还有 上述代码中 执行
    System.out.println("接收到socket:"+socket);
    System.out.println("接收到stream:"+mmInStream);
    这两行,
    打印出的信息:接收到的socket:android.bluetooth.bluetoothsocket@4054a298
    接收到的stream:android.bluetooth.bluetoothInputStream@4054b818我想问的是 
    @4054a298
    @4054b818
    都是什么意思啊………………看不懂……