OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // File-level comment to appease parser. Eventually this will not be necessary. | 5 // File-level comment to appease parser. Eventually this will not be necessary. |
6 | 6 |
7 namespace experimental.socket { | 7 namespace experimental.socket { |
8 enum SocketType { | 8 enum SocketType { |
9 tcp, | 9 tcp, |
10 udp | 10 udp |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 static void bind(long socketId, | 95 static void bind(long socketId, |
96 DOMString address, | 96 DOMString address, |
97 long port, | 97 long port, |
98 BindCallback callback); | 98 BindCallback callback); |
99 | 99 |
100 // Disconnects the socket. For UDP sockets, <code>disconnect</code> is a | 100 // Disconnects the socket. For UDP sockets, <code>disconnect</code> is a |
101 // non-operation but is safe to call. | 101 // non-operation but is safe to call. |
102 // |socketId| : The socketId. | 102 // |socketId| : The socketId. |
103 static void disconnect(long socketId); | 103 static void disconnect(long socketId); |
104 | 104 |
105 // Reads data from the given socket. | 105 // Reads data from the given socket. The received data will be delivered to |
106 // caller via callback function. Note: The given socket should be connected | |
miket_OOO
2012/07/20 19:27:44
Add "the" after "via."
I'm not sure this addition
Peng
2012/07/20 20:06:39
Done
| |
107 // by using connect() function. | |
106 // |socketId| : The socketId. | 108 // |socketId| : The socketId. |
107 // |bufferSize| : The read buffer size. | 109 // |bufferSize| : The read buffer size. |
108 // |callback| : Delivers data that was available to be read without | 110 // |callback| : Delivers data that was available to be read without |
109 // blocking. | 111 // blocking. |
110 static void read(long socketId, | 112 static void read(long socketId, |
111 optional long bufferSize, | 113 optional long bufferSize, |
112 ReadCallback callback); | 114 ReadCallback callback); |
113 | 115 |
114 // Writes data on the given socket. | 116 // Writes data on the given socket. Note: The given socket should be |
117 // connected by using connect() function. | |
miket_OOO
2012/07/20 19:27:44
Same comment as above. This addition is superfluou
Peng
2012/07/20 20:06:39
Done.
| |
115 // |socketId| : The socketId. | 118 // |socketId| : The socketId. |
116 // |data| : The data to write. | 119 // |data| : The data to write. |
117 // |callback| : Called when the first of any of the following happens: the | 120 // |callback| : Called when the write operation completes without blocking |
118 // write operation completes without blocking, the write operation blocked | 121 // or an error occurred. |
miket_OOO
2012/07/20 19:27:44
Match verb tenses ("occurred" is inconsistent).
Peng
2012/07/20 20:06:39
Done.
| |
119 // before completion (in which case onEvent() will eventually be called with | |
120 // a <code>writeComplete</code> event), or an error occurred. | |
121 static void write(long socketId, | 122 static void write(long socketId, |
122 ArrayBuffer data, | 123 ArrayBuffer data, |
123 WriteCallback callback); | 124 WriteCallback callback); |
124 | 125 |
125 // Reads data from the given socket. | 126 // Receive data from the given socket. The received data and the sender's |
miket_OOO
2012/07/20 19:27:44
Match voice ("Receive" is inconsistent).
The adde
Peng
2012/07/20 20:06:39
Done.
| |
127 // address will be delivered to caller via callback function. | |
126 // |socketId| : The socketId. | 128 // |socketId| : The socketId. |
127 // |bufferSize| : The receive buffer size. | 129 // |bufferSize| : The receive buffer size. |
128 // |callback| : Delivers data that was available to be read without | 130 // |callback| : Delivers data that was available to be read and |
129 // blocking. | 131 // sender's address without blocking. |
miket_OOO
2012/07/20 19:27:44
Same comment as above -- I'd change this to someth
Peng
2012/07/20 20:06:39
Done.
| |
130 static void recvFrom(long socketId, | 132 static void recvFrom(long socketId, |
131 optional long bufferSize, | 133 optional long bufferSize, |
132 RecvFromCallback callback); | 134 RecvFromCallback callback); |
133 | 135 |
134 // Writes data on the given socket. | 136 // Send data to the given address. The socket should be a UDP socket. |
miket_OOO
2012/07/20 19:27:44
Match voice ("Send" is inconsistent).
It would be
Peng
2012/07/20 20:06:39
Done.
| |
135 // |socketId| : The socketId. | 137 // |socketId| : The socketId. |
136 // |data| : The data to write. | 138 // |data| : The data to write. |
137 // |address| : The address of the remote machine. | 139 // |address| : The address of the remote machine. |
138 // |port| : The port of the remote machine. | 140 // |port| : The port of the remote machine. |
139 // |callback| : Called when the first of any of the following happens: the | 141 // |callback| : Called when the send operation completes without blocking |
140 // write operation completes without blocking, the write operation blocked | 142 // or an error occurred. |
miket_OOO
2012/07/20 19:27:44
Match tense ("occurred").
Peng
2012/07/20 20:06:39
Done.
| |
141 // before completion (in which case onEvent() will eventually be called with | |
142 // a <code>writeComplete</code> event), or an error occurred. | |
143 static void sendTo(long socketId, | 143 static void sendTo(long socketId, |
144 ArrayBuffer data, | 144 ArrayBuffer data, |
145 DOMString address, | 145 DOMString address, |
146 long port, | 146 long port, |
147 SendToCallback callback); | 147 SendToCallback callback); |
148 | 148 |
149 // Enable/disable keep-alive functionality for a TCP connection. | 149 // Enable/disable keep-alive functionality for a TCP connection. |
150 // |socketId| : The socketId. | 150 // |socketId| : The socketId. |
151 // |enable| : If true, enable keep-alive functionality. | 151 // |enable| : If true, enable keep-alive functionality. |
152 // |delay| : Set the delay seconds between the last data packet received | 152 // |delay| : Set the delay seconds between the last data packet received |
153 // and the first keepalive probe. Default is 0. | 153 // and the first keepalive probe. Default is 0. |
154 // |callback| : Called when the setKeepAlive attempt is complete. | 154 // |callback| : Called when the setKeepAlive attempt is complete. |
155 static void setKeepAlive(long socketId, | 155 static void setKeepAlive(long socketId, |
156 boolean enable, | 156 boolean enable, |
157 optional long delay, | 157 optional long delay, |
158 SetKeepAliveCallback callback); | 158 SetKeepAliveCallback callback); |
159 | 159 |
160 // Enable/disable Nagle algorithm. | 160 // Enable/disable Nagle algorithm. |
161 // |socketId| : The socketId. | 161 // |socketId| : The socketId. |
162 // |noDelay| : If true, disable Nagle algorithm. | 162 // |noDelay| : If true, disable Nagle algorithm. |
163 // |callback| : Called when the setNoDelay attempt is complete. | 163 // |callback| : Called when the setNoDelay attempt is complete. |
164 static void setNoDelay(long socketId, | 164 static void setNoDelay(long socketId, |
165 boolean noDelay, | 165 boolean noDelay, |
166 SetNoDelayCallback callback); | 166 SetNoDelayCallback callback); |
167 }; | 167 }; |
168 | 168 |
169 }; | 169 }; |
OLD | NEW |