Home | History | Annotate | Download | only in lib

Lines Matching refs:socket

28  * Encapsulates a connection with the emulator over a UNIX-domain socket.
30 public class Socket {
31 /** UNIX-domain socket connected with the emulator. */
33 /** Channel name for the connection established via this socket. */
44 * Constructs Socket instance.
46 * @param socket Socket connection with the emulator.
50 public Socket(LocalSocket socket, String name, ByteOrder endian) {
51 mSocket = socket;
54 if (DEBUG) Log.d(TAG, "Socket is constructed for " + mChannelName);
58 * Gets connection status of this socket.
60 * @return true if socket is connected, or false if socket is not connected.
67 * Gets channel name for this socket.
69 * @return Channel name for this socket.
76 * Gets endianness of data transferred via this socket.
78 * @return Endianness of data transferred via this socket.
85 * Sends data to the socket.
92 // Use local copy of the socket, ensuring it's not going to NULL while
99 LocalSocket socket = mSocket;
100 if (socket == null) {
101 Logw("'send' request on closed Socket " + mChannelName);
104 socket.getOutputStream().write(data);
108 * Sends data to the socket.
112 * @param len The number of bytes from data to write to this socket.
116 LocalSocket socket = mSocket;
117 if (socket == null) {
118 Logw("'send' request on closed Socket " + mChannelName);
121 socket.getOutputStream().write(data, offset, len);
125 * Receives data from the socket.
127 * @param socket Socket from where to receive data.
132 public static void receive(LocalSocket socket, byte[] data, int len) throws IOException {
133 final InputStream is = socket.getInputStream();
139 "I/O failure while receiving SDK controller data from socket.");
146 * Receives data from the socket.
153 LocalSocket socket = mSocket;
154 if (socket == null) {
155 Logw("'receive' request on closed Socket " + mChannelName);
158 receive(socket, data, len);
162 * Receives data from the socket.
173 * Closes the socket.
175 * @return true if socket has been closed in this call, or false if it had
179 // This is the only place in this class where we will null the socket
182 LocalSocket socket;
184 socket = mSocket;
187 if (socket != null) {
189 // Force all I/O to stop before closing the socket.
190 socket.shutdownInput();
191 socket.shutdownOutput();
192 socket.close();
193 if (DEBUG) Log.d(TAG, "Socket is closed for " + mChannelName);
196 Loge("Exception " + e + " while closing Socket for " + mChannelName);