OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/object_watcher.h" | 10 #include "base/object_watcher.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_log.h" | 13 #include "net/base/net_log.h" |
14 #include "net/socket/client_socket.h" | 14 #include "net/socket/client_socket.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 | 17 |
18 class BoundNetLog; | 18 class BoundNetLog; |
19 | 19 |
20 class TCPClientSocketWin : public ClientSocket { | 20 class TCPClientSocketWin : public ClientSocket { |
21 public: | 21 public: |
22 // The IP address(es) and port number to connect to. The TCP socket will try | 22 // The IP address(es) and port number to connect to. The TCP socket will try |
23 // each IP address in the list until it succeeds in establishing a | 23 // each IP address in the list until it succeeds in establishing a |
24 // connection. | 24 // connection. |
25 explicit TCPClientSocketWin(const AddressList& addresses); | 25 TCPClientSocketWin(const AddressList& addresses, net::NetLog* net_log); |
26 | 26 |
27 ~TCPClientSocketWin(); | 27 ~TCPClientSocketWin(); |
28 | 28 |
29 // ClientSocket methods: | 29 // ClientSocket methods: |
30 virtual int Connect(CompletionCallback* callback, const BoundNetLog& net_log); | 30 virtual int Connect(CompletionCallback* callback); |
31 virtual void Disconnect(); | 31 virtual void Disconnect(); |
32 virtual bool IsConnected() const; | 32 virtual bool IsConnected() const; |
33 virtual bool IsConnectedAndIdle() const; | 33 virtual bool IsConnectedAndIdle() const; |
34 virtual int GetPeerAddress(AddressList* address) const; | 34 virtual int GetPeerAddress(AddressList* address) const; |
| 35 virtual const BoundNetLog& NetLog() const { return net_log_; } |
35 | 36 |
36 // Socket methods: | 37 // Socket methods: |
37 // Multiple outstanding requests are not supported. | 38 // Multiple outstanding requests are not supported. |
38 // Full duplex mode (reading and writing at the same time) is supported | 39 // Full duplex mode (reading and writing at the same time) is supported |
39 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 40 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
40 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 41 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
41 | 42 |
42 virtual bool SetReceiveBufferSize(int32 size); | 43 virtual bool SetReceiveBufferSize(int32 size); |
43 virtual bool SetSendBufferSize(int32 size); | 44 virtual bool SetSendBufferSize(int32 size); |
44 | 45 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 CompletionCallback* write_callback_; | 81 CompletionCallback* write_callback_; |
81 | 82 |
82 BoundNetLog net_log_; | 83 BoundNetLog net_log_; |
83 | 84 |
84 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketWin); | 85 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketWin); |
85 }; | 86 }; |
86 | 87 |
87 } // namespace net | 88 } // namespace net |
88 | 89 |
89 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ | 90 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ |
OLD | NEW |