OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 patch class RawServerSocket { | 5 patch class RawServerSocket { |
6 /* patch */ static Future<RawServerSocket> bind(address, | 6 /* patch */ static Future<RawServerSocket> bind(address, |
7 int port, | 7 int port, |
8 {int backlog: 0, | 8 {int backlog: 0, |
9 bool v6Only: false}) { | 9 bool v6Only: false}) { |
10 return _RawServerSocket.bind(address, port, backlog, v6Only); | 10 return _RawServerSocket.bind(address, port, backlog, v6Only); |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 // For all errors we close the socket | 646 // For all errors we close the socket |
647 close(); | 647 close(); |
648 } | 648 } |
649 | 649 |
650 bool setOption(SocketOption option, bool enabled) { | 650 bool setOption(SocketOption option, bool enabled) { |
651 if (option is! SocketOption) throw new ArgumentError(options); | 651 if (option is! SocketOption) throw new ArgumentError(options); |
652 if (enabled is! bool) throw new ArgumentError(enabled); | 652 if (enabled is! bool) throw new ArgumentError(enabled); |
653 return nativeSetOption(option._value, enabled); | 653 return nativeSetOption(option._value, enabled); |
654 } | 654 } |
655 | 655 |
| 656 void setSocketId(int id) => nativeSetSocketId(id); |
| 657 |
| 658 void nativeSetSocketId(int id) native "Socket_SetSocketId"; |
656 nativeAvailable() native "Socket_Available"; | 659 nativeAvailable() native "Socket_Available"; |
657 nativeRead(int len) native "Socket_Read"; | 660 nativeRead(int len) native "Socket_Read"; |
658 nativeWrite(List<int> buffer, int offset, int bytes) | 661 nativeWrite(List<int> buffer, int offset, int bytes) |
659 native "Socket_WriteList"; | 662 native "Socket_WriteList"; |
660 nativeCreateConnect(List<int> addr, | 663 nativeCreateConnect(List<int> addr, |
661 int port) native "Socket_CreateConnect"; | 664 int port) native "Socket_CreateConnect"; |
662 nativeCreateBindListen(List<int> addr, int port, int backlog, bool v6Only) | 665 nativeCreateBindListen(List<int> addr, int port, int backlog, bool v6Only) |
663 native "ServerSocket_CreateBindListen"; | 666 native "ServerSocket_CreateBindListen"; |
664 nativeAccept(_NativeSocket socket) native "ServerSocket_Accept"; | 667 nativeAccept(_NativeSocket socket) native "ServerSocket_Accept"; |
665 int nativeGetPort() native "Socket_GetPort"; | 668 int nativeGetPort() native "Socket_GetPort"; |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1217 if (_detachReady != null) { | 1220 if (_detachReady != null) { |
1218 _detachReady.complete(null); | 1221 _detachReady.complete(null); |
1219 } else { | 1222 } else { |
1220 if (_raw != null) { | 1223 if (_raw != null) { |
1221 _raw.shutdown(SocketDirection.SEND); | 1224 _raw.shutdown(SocketDirection.SEND); |
1222 _disableWriteEvent(); | 1225 _disableWriteEvent(); |
1223 } | 1226 } |
1224 } | 1227 } |
1225 } | 1228 } |
1226 } | 1229 } |
OLD | NEW |