OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2010 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 | 7 |
8 // This module provides interfaces for an IO stream. The stream is | 8 // This module provides interfaces for an IO stream. The stream is |
9 // expected to throw a std::exception if the stream is terminated on | 9 // expected to throw a std::exception if the stream is terminated on |
10 // either side. | 10 // either side. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 class SocketBinding { | 42 class SocketBinding { |
43 public: | 43 public: |
44 // Wrap existing socket handle. | 44 // Wrap existing socket handle. |
45 explicit SocketBinding(NaClSocketHandle socket_handle); | 45 explicit SocketBinding(NaClSocketHandle socket_handle); |
46 // Bind to the specified TCP port. | 46 // Bind to the specified TCP port. |
47 static SocketBinding *Bind(const char *addr); | 47 static SocketBinding *Bind(const char *addr); |
48 | 48 |
49 // Accept a connection on an already-bound TCP port. | 49 // Accept a connection on an already-bound TCP port. |
50 ITransport *AcceptConnection(); | 50 ITransport *AcceptConnection(); |
51 | 51 |
| 52 // Get port the socket is bound to. |
| 53 uint16_t GetBoundPort(); |
| 54 |
52 private: | 55 private: |
53 NaClSocketHandle socket_handle_; | 56 NaClSocketHandle socket_handle_; |
54 }; | 57 }; |
55 | 58 |
56 } // namespace port | 59 } // namespace port |
57 | 60 |
58 #endif // NATIVE_CLIENT_PORT_TRANSPORT_H_ | 61 #endif // NATIVE_CLIENT_PORT_TRANSPORT_H_ |
59 | 62 |
OLD | NEW |