OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 class _SocketBase { | 6 class _SocketBase { |
7 // Bit flags used when communicating between the eventhandler and | 7 // Bit flags used when communicating between the eventhandler and |
8 // dart code. The EVENT flags are used to indicate events of | 8 // dart code. The EVENT flags are used to indicate events of |
9 // interest when sending a message from dart code to the | 9 // interest when sending a message from dart code to the |
10 // eventhandler. When receiving a message from the eventhandler the | 10 // eventhandler. When receiving a message from the eventhandler the |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 factory _Socket(String host, int port) { | 249 factory _Socket(String host, int port) { |
250 Socket socket = new _Socket._internal(); | 250 Socket socket = new _Socket._internal(); |
251 if (!socket._createConnect(host, port)) { | 251 if (!socket._createConnect(host, port)) { |
252 socket.close(); | 252 socket.close(); |
253 return null; | 253 return null; |
254 } | 254 } |
255 return socket; | 255 return socket; |
256 } | 256 } |
257 | 257 |
258 _Socket._internal(); | 258 _Socket._internal(); |
259 _Socket._internalInputOnly() : _closedRead = true; | 259 _Socket._internalReadOnly() : _closedWrite = true; |
260 _Socket._internalOutputOnly() : _closedWrite = true; | 260 _Socket._internalWriteOnly() : _closedRead = true; |
261 | 261 |
262 int available() { | 262 int available() { |
263 if (_id >= 0) { | 263 if (_id >= 0) { |
264 return _available(); | 264 return _available(); |
265 } | 265 } |
266 throw new | 266 throw new |
267 SocketIOException("Error: available failed - invalid socket handle"); | 267 SocketIOException("Error: available failed - invalid socket handle"); |
268 } | 268 } |
269 | 269 |
270 int _available() native "Socket_Available"; | 270 int _available() native "Socket_Available"; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 } | 350 } |
351 return _outputStream; | 351 return _outputStream; |
352 } | 352 } |
353 | 353 |
354 bool _closedRead = false; | 354 bool _closedRead = false; |
355 bool _closedWrite = false; | 355 bool _closedWrite = false; |
356 SocketInputStream _inputStream; | 356 SocketInputStream _inputStream; |
357 SocketOutputStream _outputStream; | 357 SocketOutputStream _outputStream; |
358 } | 358 } |
359 | 359 |
OLD | NEW |