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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 bool cancelOnError}) { | 704 bool cancelOnError}) { |
705 return _controller.stream.listen( | 705 return _controller.stream.listen( |
706 onData, | 706 onData, |
707 onError: onError, | 707 onError: onError, |
708 onDone: onDone, | 708 onDone: onDone, |
709 cancelOnError: cancelOnError); | 709 cancelOnError: cancelOnError); |
710 } | 710 } |
711 | 711 |
712 int get port => _socket.port; | 712 int get port => _socket.port; |
713 | 713 |
| 714 InternetAddress get address => _socket.address; |
| 715 |
714 Future close() => _socket.close().then((_) => this); | 716 Future close() => _socket.close().then((_) => this); |
715 | 717 |
716 void _pause() { | 718 void _pause() { |
717 _socket.setListening(read: false, write: false); | 719 _socket.setListening(read: false, write: false); |
718 } | 720 } |
719 | 721 |
720 void _resume() { | 722 void _resume() { |
721 _socket.setListening(read: true, write: false); | 723 _socket.setListening(read: true, write: false); |
722 } | 724 } |
723 | 725 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 bool cancelOnError}) { | 916 bool cancelOnError}) { |
915 return _socket.map((rawSocket) => new _Socket(rawSocket)).listen( | 917 return _socket.map((rawSocket) => new _Socket(rawSocket)).listen( |
916 onData, | 918 onData, |
917 onError: onError, | 919 onError: onError, |
918 onDone: onDone, | 920 onDone: onDone, |
919 cancelOnError: cancelOnError); | 921 cancelOnError: cancelOnError); |
920 } | 922 } |
921 | 923 |
922 int get port => _socket.port; | 924 int get port => _socket.port; |
923 | 925 |
| 926 InternetAddress get address => _socket.address; |
| 927 |
924 Future close() => _socket.close().then((_) => this); | 928 Future close() => _socket.close().then((_) => this); |
925 } | 929 } |
926 | 930 |
927 | 931 |
928 patch class Socket { | 932 patch class Socket { |
929 /* patch */ static Future<Socket> connect(host, int port) { | 933 /* patch */ static Future<Socket> connect(host, int port) { |
930 return RawSocket.connect(host, port).then( | 934 return RawSocket.connect(host, port).then( |
931 (socket) => new _Socket(socket)); | 935 (socket) => new _Socket(socket)); |
932 } | 936 } |
933 } | 937 } |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 if (_detachReady != null) { | 1213 if (_detachReady != null) { |
1210 _detachReady.complete(null); | 1214 _detachReady.complete(null); |
1211 } else { | 1215 } else { |
1212 if (_raw != null) { | 1216 if (_raw != null) { |
1213 _raw.shutdown(SocketDirection.SEND); | 1217 _raw.shutdown(SocketDirection.SEND); |
1214 _disableWriteEvent(); | 1218 _disableWriteEvent(); |
1215 } | 1219 } |
1216 } | 1220 } |
1217 } | 1221 } |
1218 } | 1222 } |
OLD | NEW |