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 // |address| : The address of the local machine. |
| 24 // |port| : The port of the local machine. |
| 25 // |backlog| : Length of the socket's accept queue. |
| 26 static void listen(long socketId, |
| 27 DOMString address, |
| 28 long port, |
| 29 long backlog, |
| 30 ListenCallback callback); |
| 31 |
| 32 // This method applies to TCP sockets only. |
| 33 // Starts waiting for connections on the listening server socket. |
| 34 // |socketId| : The socketId. |
| 35 // |callback| : The callback is invoked when a new socket is accepted. |
| 36 static void accept(long socketId, |
| 37 AcceptCallback callback); |
| 38 }; |
| 39 |
| 40 }; |
OLD | NEW |