Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: runtime/bin/socket.dart

Issue 8437090: Change the handling of closing sockets (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments by ager@ Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/process_impl.dart ('k') | runtime/bin/socket_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 interface ServerSocket factory _ServerSocket { 5 interface ServerSocket factory _ServerSocket {
6 /* 6 /*
7 * Constructs a new server socket, binds it to a given address and port, 7 * Constructs a new server socket, binds it to a given address and port,
8 * and listens on it. 8 * and listens on it.
9 */ 9 */
10 ServerSocket(String bindAddress, int port, int backlog); 10 ServerSocket(String bindAddress, int port, int backlog);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 /* 61 /*
62 * Writes up to [count] bytes of the buffer from [offset] buffer offset to 62 * Writes up to [count] bytes of the buffer from [offset] buffer offset to
63 * the socket. The number of successfully written bytes is returned. This 63 * the socket. The number of successfully written bytes is returned. This
64 * function is non-blocking and will only write data if buffer space is 64 * function is non-blocking and will only write data if buffer space is
65 * available in the socket. It will return 0 if an error occurs, e.g., no 65 * available in the socket. It will return 0 if an error occurs, e.g., no
66 * buffer space available. 66 * buffer space available.
67 */ 67 */
68 int writeList(List<int> buffer, int offset, int count); 68 int writeList(List<int> buffer, int offset, int count);
69 69
70 /* 70 /*
71 * The connect handler gets executed when connection to a given host 71 * The connect handler gets called when connection to a given host
72 * succeeded. 72 * succeeded.
73 */ 73 */
74 void set connectHandler(void callback()); 74 void set connectHandler(void callback());
75 75
76 /* 76 /*
77 * The data handler gets executed when data becomes available at the socket. 77 * The data handler gets called when data becomes available at the socket.
78 */ 78 */
79 void set dataHandler(void callback()); 79 void set dataHandler(void callback());
80 80
81 /* 81 /*
82 * The write handler gets executed when the socket becomes available for 82 * The write handler gets called when the socket becomes available for
83 * writing. 83 * writing.
84 */ 84 */
85 void set writeHandler(void callback()); 85 void set writeHandler(void callback());
86 86
87 /* 87 /*
88 * The error handler gets executed when a socket error occurs. 88 * The close handler gets called when a the last byte have been read
89 * from a socket. At this point the socket might still be open for
90 * writing for sending more data.
91 */
92 void set closeHandler(void callback());
93
94 /*
95 * The error handler gets called when a socket error occurs.
89 */ 96 */
90 void set errorHandler(void callback()); 97 void set errorHandler(void callback());
91 98
92 /* 99 /*
93 * The close handler gets executed when the socket was closed.
94 */
95 void set closeHandler(void callback());
96
97 /*
98 * Returns input stream to the socket. 100 * Returns input stream to the socket.
99 */ 101 */
100 InputStream get inputStream(); 102 InputStream get inputStream();
101 103
102 /* 104 /*
103 * Returns output stream of the socket. 105 * Returns output stream of the socket.
104 */ 106 */
105 OutputStream get outputStream(); 107 OutputStream get outputStream();
106 108
107 /* 109 /*
108 * Returns the port used by this socket. 110 * Returns the port used by this socket.
109 */ 111 */
110 int get port(); 112 int get port();
111 113
112 /* 114 /*
113 * Closes the socket. Calling [close] will never throw an exception 115 * Closes the socket. Calling [close] will never throw an exception
114 * and calling it several times is supported. 116 * and calling it several times is supported. If [halfClose] is true
117 * the socket will only be closed for writing and it might still be
118 * possible to read data. Calling [close] will not trigger a call to
119 * the [closeHandler].
115 */ 120 */
116 void close(); 121 void close([bool halfClose]);
117 } 122 }
118 123
119 124
120 class SocketIOException implements Exception { 125 class SocketIOException implements Exception {
121 const SocketIOException([String this.message = ""]); 126 const SocketIOException([String this.message = ""]);
122 String toString() => "SocketIOException: $message"; 127 String toString() => "SocketIOException: $message";
123 128
124 /* 129 /*
125 * Contains the exception message. 130 * Contains the exception message.
126 */ 131 */
127 final String message; 132 final String message;
128 } 133 }
OLDNEW
« no previous file with comments | « runtime/bin/process_impl.dart ('k') | runtime/bin/socket_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698