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 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 | 7 |
8 /** | 8 /** |
9 * [InternetAddressType] is the type an [InternetAddress]. Currently, | 9 * [InternetAddressType] is the type an [InternetAddress]. Currently, |
10 * IP version 4 (IPv4) and IP version 6 (IPv6) are supported. | 10 * IP version 4 (IPv4) and IP version 6 (IPv6) are supported. |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 } | 756 } |
757 | 757 |
758 | 758 |
759 class SocketException implements IOException { | 759 class SocketException implements IOException { |
760 final String message; | 760 final String message; |
761 final OSError osError; | 761 final OSError osError; |
762 final InternetAddress address; | 762 final InternetAddress address; |
763 final int port; | 763 final int port; |
764 | 764 |
765 const SocketException(this.message, {this.osError, this.address, this.port}); | 765 const SocketException(this.message, {this.osError, this.address, this.port}); |
| 766 const SocketException.closed() : message = 'Socket has been closed'; |
766 | 767 |
767 String toString() { | 768 String toString() { |
768 StringBuffer sb = new StringBuffer(); | 769 StringBuffer sb = new StringBuffer(); |
769 sb.write("SocketException"); | 770 sb.write("SocketException"); |
770 if (!message.isEmpty) { | 771 if (!message.isEmpty) { |
771 sb.write(": $message"); | 772 sb.write(": $message"); |
772 if (osError != null) { | 773 if (osError != null) { |
773 sb.write(" ($osError)"); | 774 sb.write(" ($osError)"); |
774 } | 775 } |
775 } else if (osError != null) { | 776 } else if (osError != null) { |
776 sb.write(": $osError"); | 777 sb.write(": $osError"); |
777 } | 778 } |
778 if (address != null) { | 779 if (address != null) { |
779 sb.write(", address = ${address.host}"); | 780 sb.write(", address = ${address.host}"); |
780 } | 781 } |
781 if (port != null) { | 782 if (port != null) { |
782 sb.write(", port = $port"); | 783 sb.write(", port = $port"); |
783 } | 784 } |
784 return sb.toString(); | 785 return sb.toString(); |
785 } | 786 } |
786 } | 787 } |
OLD | NEW |