| 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 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 void leaveMulticast(InternetAddress addr, NetworkInterface interface) { | 1054 void leaveMulticast(InternetAddress addr, NetworkInterface interface) { |
| 1055 var interfaceAddr = multicastAddress(addr, interface); | 1055 var interfaceAddr = multicastAddress(addr, interface); |
| 1056 var interfaceIndex = interface == null ? 0 : interface.index; | 1056 var interfaceIndex = interface == null ? 0 : interface.index; |
| 1057 var result = nativeLeaveMulticast( | 1057 var result = nativeLeaveMulticast( |
| 1058 addr._in_addr, | 1058 addr._in_addr, |
| 1059 interfaceAddr == null ? null : interfaceAddr._in_addr, | 1059 interfaceAddr == null ? null : interfaceAddr._in_addr, |
| 1060 interfaceIndex); | 1060 interfaceIndex); |
| 1061 if (result is OSError) throw result; | 1061 if (result is OSError) throw result; |
| 1062 } | 1062 } |
| 1063 | 1063 |
| 1064 String get _serviceTypePath => 'io/socket'; | 1064 String get _serviceTypePath => 'io/sockets'; |
| 1065 String get _serviceTypeName => 'Socket'; | 1065 String get _serviceTypeName => 'Socket'; |
| 1066 | 1066 |
| 1067 Map _toJSON(bool ref) { | 1067 Map _toJSON(bool ref) { |
| 1068 var name = '${address.host}:$port'; |
| 1069 if (isTcp && !isListening) name += " <-> ${remoteAddress.host}:$remotePort"; |
| 1068 var r = { | 1070 var r = { |
| 1069 'id': _servicePath, | 1071 'id': _servicePath, |
| 1070 'type': _serviceType(ref), | 1072 'type': _serviceType(ref), |
| 1071 'name': '${address.host}:$port', | 1073 'name': name, |
| 1072 'user_name': '${address.host}:$port', | 1074 'user_name': name, |
| 1073 }; | 1075 }; |
| 1074 if (ref) { | 1076 if (ref) { |
| 1075 return r; | 1077 return r; |
| 1076 } | 1078 } |
| 1077 r['port'] = port; | 1079 r['port'] = port; |
| 1078 r['address'] = address.host; | 1080 r['address'] = address.host; |
| 1081 r['fd'] = nativeGetSocketId(); |
| 1079 return r; | 1082 return r; |
| 1080 } | 1083 } |
| 1081 | 1084 |
| 1082 void nativeSetSocketId(int id) native "Socket_SetSocketId"; | 1085 void nativeSetSocketId(int id) native "Socket_SetSocketId"; |
| 1083 nativeAvailable() native "Socket_Available"; | 1086 nativeAvailable() native "Socket_Available"; |
| 1084 nativeRead(int len) native "Socket_Read"; | 1087 nativeRead(int len) native "Socket_Read"; |
| 1085 nativeRecvFrom() native "Socket_RecvFrom"; | 1088 nativeRecvFrom() native "Socket_RecvFrom"; |
| 1086 nativeWrite(List<int> buffer, int offset, int bytes) | 1089 nativeWrite(List<int> buffer, int offset, int bytes) |
| 1087 native "Socket_WriteList"; | 1090 native "Socket_WriteList"; |
| 1088 nativeSendTo(List<int> buffer, int offset, int bytes, | 1091 nativeSendTo(List<int> buffer, int offset, int bytes, |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1889 String address, | 1892 String address, |
| 1890 List<int> in_addr, | 1893 List<int> in_addr, |
| 1891 int port) { | 1894 int port) { |
| 1892 return new Datagram( | 1895 return new Datagram( |
| 1893 data, | 1896 data, |
| 1894 new _InternetAddress(address, null, in_addr), | 1897 new _InternetAddress(address, null, in_addr), |
| 1895 port); | 1898 port); |
| 1896 } | 1899 } |
| 1897 | 1900 |
| 1898 String _socketsStats() => _SocketsObservatory.toJSON(); | 1901 String _socketsStats() => _SocketsObservatory.toJSON(); |
| OLD | NEW |