OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 namespace experimental.socket { |
| 6 |
| 7 dictionary AcceptInfo { |
| 8 // The id of the accepted socket. |
| 9 long socketId; |
| 10 long resultCode; |
| 11 }; |
| 12 |
| 13 callback ListenCallback = void (long result); |
| 14 |
| 15 callback AcceptCallback = void (AcceptInfo acceptInfo); |
| 16 |
| 17 interface Functions { |
| 18 // This method applies to TCP sockets only. |
| 19 // Listens for connections on the specified port that this socket was bound |
| 20 // to. This effectively makes this a server socket and client socket |
| 21 // functions (connect, read, write) can no longer be used on this socket. |
| 22 // |socketId| : The socketId. |
| 23 // |backlog| : Length of the socket's accept queue. |
| 24 static void listen(long socketId, |
| 25 long backlog, |
| 26 ListenCallback callback); |
| 27 |
| 28 // This method applies to TCP sockets only. |
| 29 // Starts waiting for connections on the listening server socket. |
| 30 // |socketId| : The socketId. |
| 31 // |callback| : The callback is invoked when a new socket is accepted. |
| 32 static void accept(long socketId, |
| 33 AcceptCallback callback); |
| 34 }; |
| 35 |
| 36 }; |
OLD | NEW |