| 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 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 if (result is OSError) throw result; | 766 if (result is OSError) throw result; |
| 767 } | 767 } |
| 768 | 768 |
| 769 InternetAddress multicastAddress( | 769 InternetAddress multicastAddress( |
| 770 InternetAddress addr, NetworkInterface interface) { | 770 InternetAddress addr, NetworkInterface interface) { |
| 771 // On Mac OS using the interface index for joining IPv4 multicast groups | 771 // On Mac OS using the interface index for joining IPv4 multicast groups |
| 772 // is not supported. Here the IP address of the interface is needed. | 772 // is not supported. Here the IP address of the interface is needed. |
| 773 if (Platform.isMacOS && addr.type == InternetAddressType.IP_V4) { | 773 if (Platform.isMacOS && addr.type == InternetAddressType.IP_V4) { |
| 774 if (interface != null) { | 774 if (interface != null) { |
| 775 for (int i = 0; i < interface.addresses.length; i++) { | 775 for (int i = 0; i < interface.addresses.length; i++) { |
| 776 if (addr.type == InternetAddressType.IP_V4) { | 776 if (interface.addresses[i].type == InternetAddressType.IP_V4) { |
| 777 return interface.addresses[i]; | 777 return interface.addresses[i]; |
| 778 } | 778 } |
| 779 } | 779 } |
| 780 // No IPv4 address found on the interface. | 780 // No IPv4 address found on the interface. |
| 781 throw new SocketException( | 781 throw new SocketException( |
| 782 "The network interface does not have an address " | 782 "The network interface does not have an address " |
| 783 "of the same family as the multicast address"); | 783 "of the same family as the multicast address"); |
| 784 } else { | 784 } else { |
| 785 // Default to the ANY address if on iterface is specified. | 785 // Default to the ANY address if no iterface is specified. |
| 786 return InternetAddress.ANY_IP_V4; | 786 return InternetAddress.ANY_IP_V4; |
| 787 } | 787 } |
| 788 } else { | 788 } else { |
| 789 return null; | 789 return null; |
| 790 } | 790 } |
| 791 } | 791 } |
| 792 | 792 |
| 793 void joinMulticast(InternetAddress addr, NetworkInterface interface) { | 793 void joinMulticast(InternetAddress addr, NetworkInterface interface) { |
| 794 var interfaceAddr = multicastAddress(addr, interface); | 794 var interfaceAddr = multicastAddress(addr, interface); |
| 795 var interfaceIndex = interface == null ? 0 : interface.index; | 795 var interfaceIndex = interface == null ? 0 : interface.index; |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 | 1545 |
| 1546 Datagram _makeDatagram(List<int> data, | 1546 Datagram _makeDatagram(List<int> data, |
| 1547 String address, | 1547 String address, |
| 1548 List<int> in_addr, | 1548 List<int> in_addr, |
| 1549 int port) { | 1549 int port) { |
| 1550 return new Datagram( | 1550 return new Datagram( |
| 1551 data, | 1551 data, |
| 1552 new _InternetAddress(address, null, in_addr), | 1552 new _InternetAddress(address, null, in_addr), |
| 1553 port); | 1553 port); |
| 1554 } | 1554 } |
| OLD | NEW |