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