| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 [DartPackage="mojo_services"] |
| 5 module mojo; | 6 module mojo; |
| 6 | 7 |
| 8 import "mojo/public/interfaces/network/network_error.mojom"; |
| 7 import "network/interfaces/net_address.mojom"; | 9 import "network/interfaces/net_address.mojom"; |
| 8 import "network/interfaces/tcp_connected_socket.mojom"; | 10 import "network/interfaces/tcp_connected_socket.mojom"; |
| 9 import "network/interfaces/tcp_server_socket.mojom"; | 11 import "network/interfaces/tcp_server_socket.mojom"; |
| 10 import "third_party/mojo/src/mojo/public/interfaces/network/network_error.mojom"
; | |
| 11 | 12 |
| 12 // Represents a TCP socket that is bound to a local address and port, but | 13 // Represents a TCP socket that is bound to a local address and port, but |
| 13 // is not yet in a listening or connected state. | 14 // is not yet in a listening or connected state. |
| 14 // | 15 // |
| 15 // A bound socket can be used to create a server socket listening on the | 16 // A bound socket can be used to create a server socket listening on the |
| 16 // local address, or it can be used to create a client socket by connecting to | 17 // local address, or it can be used to create a client socket by connecting to |
| 17 // a remote host. Once StartListening or Connect is called on the bound socket, | 18 // a remote host. Once StartListening or Connect is called on the bound socket, |
| 18 // ownership of the underlying socket will be transferred to the connected or | 19 // ownership of the underlying socket will be transferred to the connected or |
| 19 // server socket, and the bound socket may be closed. | 20 // server socket, and the bound socket may be closed. |
| 20 interface TCPBoundSocket { | 21 interface TCPBoundSocket { |
| 21 // Puts the socket into server mode, awaiting incoming connections. | 22 // Puts the socket into server mode, awaiting incoming connections. |
| 22 // | 23 // |
| 23 // Once this function is called, neither StartListening nor Connect can be | 24 // Once this function is called, neither StartListening nor Connect can be |
| 24 // used on this socket again. | 25 // used on this socket again. |
| 25 StartListening(TCPServerSocket& server) => (NetworkError result); | 26 StartListening(TCPServerSocket& server) => (NetworkError result); |
| 26 | 27 |
| 27 // Puts this socket into client mode by connecting to a remote host. If you | 28 // Puts this socket into client mode by connecting to a remote host. If you |
| 28 // do not care about the local address or port, you can call | 29 // do not care about the local address or port, you can call |
| 29 // NetworkService.CreateTCPConnectedSocket to connect directly and skip the | 30 // NetworkService.CreateTCPConnectedSocket to connect directly and skip the |
| 30 // "bound" state. | 31 // "bound" state. |
| 31 // | 32 // |
| 32 // Once this function is called, neither StartListening nor Connect can be | 33 // Once this function is called, neither StartListening nor Connect can be |
| 33 // used on this socket again. | 34 // used on this socket again. |
| 34 Connect(NetAddress remote_address, | 35 Connect(NetAddress remote_address, |
| 35 handle<data_pipe_consumer> send_stream, | 36 handle<data_pipe_consumer> send_stream, |
| 36 handle<data_pipe_producer> receive_stream, | 37 handle<data_pipe_producer> receive_stream, |
| 37 TCPConnectedSocket& client_socket) | 38 TCPConnectedSocket& client_socket) |
| 38 => (NetworkError result); | 39 => (NetworkError result); |
| 39 }; | 40 }; |
| OLD | NEW |