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

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

Issue 9285017: Comment and white-space cleanup in IO libraries. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: More of the same. Created 8 years, 11 months 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 default _ServerSocket { 5 interface ServerSocket default _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);
11 11
12 /* 12 /**
13 * The connection handler gets called when there is a new incoming 13 * The connection handler gets called when there is a new incoming
14 * connection on the socket. 14 * connection on the socket.
15 */ 15 */
16 void set connectionHandler(void callback(Socket connection)); 16 void set connectionHandler(void callback(Socket connection));
17 17
18 /* 18 /**
19 * The error handler gets called when a socket error occurs. 19 * The error handler gets called when a socket error occurs.
20 */ 20 */
21 void set errorHandler(void callback()); 21 void set errorHandler(void callback());
22 22
23 /* 23 /**
24 * Returns the port used by this socket. 24 * Returns the port used by this socket.
25 */ 25 */
26 int get port(); 26 int get port();
27 27
28 /* 28 /**
29 * Closes the socket. 29 * Closes the socket.
30 */ 30 */
31 void close(); 31 void close();
32 } 32 }
33 33
34 34
35 interface Socket default _Socket { 35 interface Socket default _Socket {
36 /* 36 /**
37 * Constructs a new socket and connects it to the given host on the given 37 * Constructs a new socket and connects it to the given host on the given
38 * port. 38 * port.
39 */ 39 */
40 Socket(String host, int port); 40 Socket(String host, int port);
41 41
42 /* 42 /**
43 * Returns the number of received and non-read bytes in the socket that 43 * Returns the number of received and non-read bytes in the socket that
44 * can be read. 44 * can be read.
45 */ 45 */
46 int available(); 46 int available();
47 47
48 /* 48 /**
49 * Reads up to [count] bytes of data from the socket and stores them into 49 * Reads up to [count] bytes of data from the socket and stores them into
50 * buffer after buffer offset [offset]. The number of successfully read 50 * buffer after buffer offset [offset]. The number of successfully read
51 * bytes is returned. This function is non-blocking and will only read data 51 * bytes is returned. This function is non-blocking and will only read data
52 * if data is available. 52 * if data is available.
53 */ 53 */
54 int readList(List<int> buffer, int offset, int count); 54 int readList(List<int> buffer, int offset, int count);
55 55
56 /* 56 /**
57 * Writes up to [count] bytes of the buffer from [offset] buffer offset to 57 * Writes up to [count] bytes of the buffer from [offset] buffer offset to
58 * the socket. The number of successfully written bytes is returned. This 58 * the socket. The number of successfully written bytes is returned. This
59 * function is non-blocking and will only write data if buffer space is 59 * function is non-blocking and will only write data if buffer space is
60 * available in the socket. 60 * available in the socket.
61 */ 61 */
62 int writeList(List<int> buffer, int offset, int count); 62 int writeList(List<int> buffer, int offset, int count);
63 63
64 /* 64 /**
65 * The connect handler gets called when connection to a given host 65 * The connect handler gets called when connection to a given host
66 * succeeded. 66 * succeeded.
67 */ 67 */
68 void set connectHandler(void callback()); 68 void set connectHandler(void callback());
69 69
70 /* 70 /**
71 * The data handler gets called when data becomes available at the socket. 71 * The data handler gets called when data becomes available at the socket.
72 */ 72 */
73 void set dataHandler(void callback()); 73 void set dataHandler(void callback());
74 74
75 /* 75 /**
76 * The write handler gets called when the socket becomes available for 76 * The write handler gets called when the socket becomes available for
77 * writing. 77 * writing.
78 */ 78 */
79 void set writeHandler(void callback()); 79 void set writeHandler(void callback());
80 80
81 /* 81 /**
82 * The close handler gets called when a the last byte have been read 82 * The close handler gets called when a the last byte have been read
83 * from a socket. At this point the socket might still be open for 83 * from a socket. At this point the socket might still be open for
84 * writing for sending more data. 84 * writing for sending more data.
85 */ 85 */
86 void set closeHandler(void callback()); 86 void set closeHandler(void callback());
87 87
88 /* 88 /**
89 * The error handler gets called when a socket error occurs. 89 * The error handler gets called when a socket error occurs.
90 */ 90 */
91 void set errorHandler(void callback()); 91 void set errorHandler(void callback());
92 92
93 /* 93 /**
94 * Returns input stream to the socket. 94 * Returns input stream to the socket.
95 */ 95 */
96 InputStream get inputStream(); 96 InputStream get inputStream();
97 97
98 /* 98 /**
99 * Returns output stream of the socket. 99 * Returns output stream of the socket.
100 */ 100 */
101 OutputStream get outputStream(); 101 OutputStream get outputStream();
102 102
103 /* 103 /**
104 * Returns the port used by this socket. 104 * Returns the port used by this socket.
105 */ 105 */
106 int get port(); 106 int get port();
107 107
108 /* 108 /**
109 * Closes the socket. Calling [close] will never throw an exception 109 * Closes the socket. Calling [close] will never throw an exception
110 * and calling it several times is supported. If [halfClose] is true 110 * and calling it several times is supported. If [halfClose] is true
111 * the socket will only be closed for writing and it might still be 111 * the socket will only be closed for writing and it might still be
112 * possible to read data. Calling [close] will not trigger a call to 112 * possible to read data. Calling [close] will not trigger a call to
113 * the [closeHandler]. 113 * the [closeHandler].
114 */ 114 */
115 void close([bool halfClose]); 115 void close([bool halfClose]);
116 } 116 }
117 117
118 118
119 class SocketIOException implements Exception { 119 class SocketIOException implements Exception {
120 const SocketIOException([String this.message = ""]); 120 const SocketIOException([String this.message = ""]);
121 String toString() => "SocketIOException: $message"; 121 String toString() => "SocketIOException: $message";
122
123 /*
124 * Contains the exception message.
125 */
126 final String message; 122 final String message;
127 } 123 }
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