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 const SocketException.closed() |
| 767 : message = 'Socket has been closed', |
| 768 osError = null, |
| 769 address = null, |
| 770 port = null; |
767 | 771 |
768 String toString() { | 772 String toString() { |
769 StringBuffer sb = new StringBuffer(); | 773 StringBuffer sb = new StringBuffer(); |
770 sb.write("SocketException"); | 774 sb.write("SocketException"); |
771 if (!message.isEmpty) { | 775 if (!message.isEmpty) { |
772 sb.write(": $message"); | 776 sb.write(": $message"); |
773 if (osError != null) { | 777 if (osError != null) { |
774 sb.write(" ($osError)"); | 778 sb.write(" ($osError)"); |
775 } | 779 } |
776 } else if (osError != null) { | 780 } else if (osError != null) { |
777 sb.write(": $osError"); | 781 sb.write(": $osError"); |
778 } | 782 } |
779 if (address != null) { | 783 if (address != null) { |
780 sb.write(", address = ${address.host}"); | 784 sb.write(", address = ${address.host}"); |
781 } | 785 } |
782 if (port != null) { | 786 if (port != null) { |
783 sb.write(", port = $port"); | 787 sb.write(", port = $port"); |
784 } | 788 } |
785 return sb.toString(); | 789 return sb.toString(); |
786 } | 790 } |
787 } | 791 } |
OLD | NEW |