Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_H_ | 5 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_H_ |
| 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_H_ | 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "net/base/address_list.h" | 11 #include "net/base/address_list.h" |
| 12 #include "net/base/completion_callback.h" | 12 #include "net/base/completion_callback.h" |
| 13 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
| 14 #include "net/log/net_log.h" | 14 #include "net/log/net_log.h" |
| 15 #include "net/socket/connection_attempts.h" | 15 #include "net/socket/connection_attempts.h" |
| 16 #include "net/socket/stream_socket.h" | 16 #include "net/socket/stream_socket.h" |
| 17 #include "net/socket/tcp_socket.h" | 17 #include "net/socket/tcp_socket.h" |
| 18 | 18 |
| 19 namespace net { | 19 namespace net { |
| 20 | 20 |
| 21 // A client socket that uses TCP as the transport layer. | 21 // A client socket that uses TCP as the transport layer. |
| 22 class NET_EXPORT TCPClientSocket : public StreamSocket { | 22 class NET_EXPORT TCPClientSocket : public StreamSocket { |
| 23 public: | 23 public: |
| 24 // The IP address(es) and port number to connect to. The TCP socket will try | 24 // The IP address(es) and port number to connect to. The TCP socket will try |
| 25 // each IP address in the list until it succeeds in establishing a | 25 // each IP address in the list until it succeeds in establishing a |
| 26 // connection. | 26 // connection. |
| 27 TCPClientSocket(const AddressList& addresses, | 27 TCPClientSocket( |
| 28 net::NetLog* net_log, | 28 const AddressList& addresses, |
| 29 const net::NetLog::Source& source); | 29 scoped_ptr<SocketPerformanceWatcher> socket_performance_watcher, |
|
Ryan Sleevi
2015/10/20 00:10:36
Note that |addresses| is plural; this API contract
tbansal1
2016/02/05 19:44:15
Good point. Added a Reset() function to SocketPerf
| |
| 30 net::NetLog* net_log, | |
| 31 const net::NetLog::Source& source); | |
| 30 | 32 |
| 31 // Adopts the given, connected socket and then acts as if Connect() had been | 33 // Adopts the given, connected socket and then acts as if Connect() had been |
| 32 // called. This function is used by TCPServerSocket and for testing. | 34 // called. This function is used by TCPServerSocket and for testing. |
| 33 TCPClientSocket(scoped_ptr<TCPSocket> connected_socket, | 35 TCPClientSocket(scoped_ptr<TCPSocket> connected_socket, |
| 34 const IPEndPoint& peer_address); | 36 const IPEndPoint& peer_address); |
| 35 | 37 |
| 36 ~TCPClientSocket() override; | 38 ~TCPClientSocket() override; |
| 37 | 39 |
| 38 // Binds the socket to a local IP address and port. | 40 // Binds the socket to a local IP address and port. |
| 39 int Bind(const IPEndPoint& address); | 41 int Bind(const IPEndPoint& address); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 | 129 |
| 128 // Failed connection attempts made while trying to connect this socket. | 130 // Failed connection attempts made while trying to connect this socket. |
| 129 ConnectionAttempts connection_attempts_; | 131 ConnectionAttempts connection_attempts_; |
| 130 | 132 |
| 131 DISALLOW_COPY_AND_ASSIGN(TCPClientSocket); | 133 DISALLOW_COPY_AND_ASSIGN(TCPClientSocket); |
| 132 }; | 134 }; |
| 133 | 135 |
| 134 } // namespace net | 136 } // namespace net |
| 135 | 137 |
| 136 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_H_ | 138 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_H_ |
| OLD | NEW |