Java.io.ioexception Read Failed Socket Might Closed or Timeout, Read Ret
Class Overview
A listening Bluetooth socket.
The interface for Bluetooth Sockets is like to that of TCP sockets: Socket and ServerSocket. On the server side, utilize a BluetoothServerSocket to create a listening server socket. When a connection is accepted by the BluetoothServerSocket, it will return a new BluetoothSocket to manage the connection. On the client side, apply a single BluetoothSocket to both initiate an outgoing connection and to manage the connexion.
The most common type of Bluetooth socket is RFCOMM, which is the type supported by the Android APIs. RFCOMM is a connection-oriented, streaming transport over Bluetooth. Information technology is also known as the Series Port Profile (SPP).
To create a listening BluetoothServerSocket that's ready for incoming connections, use BluetoothAdapter.listenUsingRfcommWithServiceRecord(). Then call accept() to listen for incoming connection requests. This telephone call will cake until a connectedness is established, at which point, information technology volition render a BluetoothSocket to manage the connexion. In one case the BluetoothSocket is acquired, it's a good idea to call close() on the BluetoothServerSocket when it'southward no longer needed for accepting connections. Closing the BluetoothServerSocket volition non close the returned BluetoothSocket.
BluetoothServerSocket is thread safe. In item, shut() will always immediately arrest ongoing operations and close the server socket.
Note: Requires the BLUETOOTH permission.
Developer Guides
For more information about using Bluetooth, read the Bluetooth developer guide.
Summary
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| | Block until a connexion is established, with timeout. | ||||||||||
| | Block until a connectedness is established. | ||||||||||
| | Immediately close this socket, and release all associated resources. | ||||||||||
| [Aggrandize] Inherited Methods | |||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||||||||||||||||||||||||
From interface java.io.Closeable
| |||||||||||||||||||||||||||||||||
Public Methods
public BluetoothSocket accept (int timeout)
Cake until a connection is established, with timeout.
Returns a connected BluetoothSocket on successful connection.
In one case this call returns, it can be called again to accept subsequent incoming connections.
close() can be used to abort this call from another thread.
Throws
| IOException | on error, for instance this call was aborted, or timeout |
|---|
public BluetoothSocket accept ()
Block until a connection is established.
Returns a connected BluetoothSocket on successful connexion.
Once this call returns, it tin can be chosen again to take subsequent incoming connections.
shut() can be used to abort this call from some other thread.
Throws
| IOException | on error, for case this call was aborted, or timeout |
|---|
public void close ()
Immediately close this socket, and release all associated resource.
Causes blocked calls on this socket in other threads to immediately throw an IOException.
Closing the BluetoothServerSocket will not close any BluetoothSocket received from take().
Source: https://stuff.mit.edu/afs/sipb/project/android/docs/reference/android/bluetooth/BluetoothServerSocket.html
From class java.lang.Object
0 Response to "Java.io.ioexception Read Failed Socket Might Closed or Timeout, Read Ret"
Enviar um comentário