OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_WIN_H_ | 5 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ |
6 #define NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ | 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ |
7 | 7 |
8 #include <winsock2.h> | 8 #include <winsock2.h> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 14 matching lines...) Expand all Loading... |
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 TCPClientSocketWin(const AddressList& addresses, | 27 TCPClientSocketWin(const AddressList& addresses, |
28 net::NetLog* net_log, | 28 net::NetLog* net_log, |
29 const net::NetLog::Source& source); | 29 const net::NetLog::Source& source); |
30 | 30 |
31 virtual ~TCPClientSocketWin(); | 31 virtual ~TCPClientSocketWin(); |
32 | 32 |
33 // AdoptSocket causes the given, connected socket to be adopted as a TCP | 33 // AdoptSocket causes the given, connected socket to be adopted as a TCP |
34 // socket. This object must not be connected. This object takes ownership of | 34 // socket. This object must not be connected. This object takes ownership of |
35 // the given socket and then acts as if Connect() had been called. This | 35 // the given socket and then acts as if Connect() had been called. On failure, |
36 // function is used by TCPServerSocket() to adopt accepted connections | 36 // the given socket is closed. |
37 // and for testing. | 37 // This function is used by TCPServerSocket to adopt accepted connections and |
| 38 // for testing. |
38 int AdoptSocket(SOCKET socket); | 39 int AdoptSocket(SOCKET socket); |
39 | 40 |
40 // Binds the socket to a local IP address and port. | 41 // Binds the socket to a local IP address and port. |
41 int Bind(const IPEndPoint& address); | 42 int Bind(const IPEndPoint& address); |
42 | 43 |
43 // StreamSocket implementation. | 44 // StreamSocket implementation. |
44 virtual int Connect(const CompletionCallback& callback); | 45 virtual int Connect(const CompletionCallback& callback); |
45 virtual void Disconnect(); | 46 virtual void Disconnect(); |
46 virtual bool IsConnected() const; | 47 virtual bool IsConnected() const; |
47 virtual bool IsConnectedAndIdle() const; | 48 virtual bool IsConnectedAndIdle() const; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // Record of connectivity and transmissions, for use in speculative connection | 154 // Record of connectivity and transmissions, for use in speculative connection |
154 // histograms. | 155 // histograms. |
155 UseHistory use_history_; | 156 UseHistory use_history_; |
156 | 157 |
157 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketWin); | 158 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketWin); |
158 }; | 159 }; |
159 | 160 |
160 } // namespace net | 161 } // namespace net |
161 | 162 |
162 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ | 163 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ |
OLD | NEW |