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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 InternetAddressType.IP_V4, "0.0.0.0", "0.0.0.0", sockaddr); | 81 InternetAddressType.IP_V4, "0.0.0.0", "0.0.0.0", sockaddr); |
82 case _ADDRESS_ANY_IP_V6: | 82 case _ADDRESS_ANY_IP_V6: |
83 return new _InternetAddress( | 83 return new _InternetAddress( |
84 InternetAddressType.IP_V6, "::", "::", sockaddr); | 84 InternetAddressType.IP_V6, "::", "::", sockaddr); |
85 default: | 85 default: |
86 assert(false); | 86 assert(false); |
87 throw new ArgumentError(); | 87 throw new ArgumentError(); |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
| 91 // Create a clone of this _InternetAddress replacing the host. |
| 92 _InternetAddress _cloneWithNewHost(String host) { |
| 93 return new _InternetAddress( |
| 94 type, address, host, new Uint8List.fromList(_sockaddr_storage)); |
| 95 } |
| 96 |
91 String toString() { | 97 String toString() { |
92 return "InternetAddress('$address', ${type.name})"; | 98 return "InternetAddress('$address', ${type.name})"; |
93 } | 99 } |
94 | 100 |
95 static Uint8List _fixed(int id) native "InternetAddress_Fixed"; | 101 static Uint8List _fixed(int id) native "InternetAddress_Fixed"; |
96 } | 102 } |
97 | 103 |
98 | 104 |
99 // The _NativeSocket class encapsulates an OS socket. | 105 // The _NativeSocket class encapsulates an OS socket. |
100 class _NativeSocket extends NativeFieldWrapperClass1 { | 106 class _NativeSocket extends NativeFieldWrapperClass1 { |
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 if (_detachReady != null) { | 1071 if (_detachReady != null) { |
1066 _detachReady.complete(null); | 1072 _detachReady.complete(null); |
1067 } else { | 1073 } else { |
1068 if (_raw != null) { | 1074 if (_raw != null) { |
1069 _raw.shutdown(SocketDirection.SEND); | 1075 _raw.shutdown(SocketDirection.SEND); |
1070 _disableWriteEvent(); | 1076 _disableWriteEvent(); |
1071 } | 1077 } |
1072 } | 1078 } |
1073 } | 1079 } |
1074 } | 1080 } |
OLD | NEW |