I tried, but it did not work. It seems SocketInputStream does not
implement InterruptibleChannel interface.
Thanks.

On Aug 6, 6:30 pm, Streets Of Boston <[email protected]> wrote:
> Try interrupt() thethreadas well, which will cause any wait-state
> (wait(...), sleep(...)) to end and throw an interrupt exception.
> Also, try to not only close the socket by the mmlnStream as well.
>
> On Aug 6, 4:03 pm, cas <[email protected]> wrote:
>
> > Hi
>
> > Here is athreadexample in Android SDK sample (BluetoothChat)
>
> >             while (true) {
> >                 try {
> >                     // Read from the InputStream
> >                     bytes = mmInStream.read(buffer);
>
> >                     // Send the obtained bytes to the UI Activity
> >                     mHandler.obtainMessage(BluetoothChat.MESSAGE_READ,
> > bytes, -1, buffer)
> >                             .sendToTarget();
> >                 } catch (IOException e) {
> >                     Log.e(TAG, "disconnected", e);
> >                     connectionLost();
> >                     break;
> >                 }
> >             }
>
> > In order to destroy thisthread, first to close the socket. But this
> >threadis still running at the blocked call mmInStream.read() even
> > mSocket.close is successfully run.
>
> > Question: How to properly destroy athreadstuck in blocked call?
>
> > Thanks and regards.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to