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_UDP_DATAGRAM_CLIENT_SOCKET_H_ | 5 #ifndef NET_UDP_DATAGRAM_CLIENT_SOCKET_H_ |
6 #define NET_UDP_DATAGRAM_CLIENT_SOCKET_H_ | 6 #define NET_UDP_DATAGRAM_CLIENT_SOCKET_H_ |
7 | 7 |
8 #include "net/base/network_change_notifier.h" | 8 #include "net/base/network_change_notifier.h" |
9 #include "net/socket/socket.h" | 9 #include "net/socket/socket.h" |
10 #include "net/udp/datagram_socket.h" | 10 #include "net/udp/datagram_socket.h" |
11 | 11 |
12 namespace net { | 12 namespace net { |
13 | 13 |
14 class IPEndPoint; | 14 class IPEndPoint; |
15 | 15 |
16 class NET_EXPORT_PRIVATE DatagramClientSocket : public DatagramSocket, | 16 class NET_EXPORT_PRIVATE DatagramClientSocket : public DatagramSocket, |
17 public Socket { | 17 public Socket { |
18 public: | 18 public: |
19 ~DatagramClientSocket() override {} | 19 ~DatagramClientSocket() override {} |
20 | 20 |
21 // Binds this socket to |network|. All data traffic on the socket will be sent | 21 // Binds this socket to |network|. All data traffic on the socket will be sent |
22 // and received via |network|. Must be called before Connect(). This call will | 22 // and received via |network|. Must be called before Connect(). This call will |
23 // fail if |network| has disconnected. Communication using this socket will | 23 // fail if |network| has disconnected. Communication using this socket will |
24 // fail if |network| disconnects. | 24 // fail if |network| disconnects. |
25 // Returns a net error code. | 25 // Returns a net error code. |
26 virtual int BindToNetwork(NetworkChangeNotifier::NetworkHandle network) = 0; | 26 virtual int BindToNetwork(NetworkChangeNotifier::NetworkHandle network) = 0; |
27 | 27 |
| 28 // Same as BindToNetwork, except that the current default network is used. |
| 29 // Returns a net error code. |
| 30 virtual int BindToDefaultNetwork() = 0; |
| 31 |
28 // Initialize this socket as a client socket to server at |address|. | 32 // Initialize this socket as a client socket to server at |address|. |
29 // Returns a network error code. | 33 // Returns a network error code. |
30 virtual int Connect(const IPEndPoint& address) = 0; | 34 virtual int Connect(const IPEndPoint& address) = 0; |
31 }; | 35 }; |
32 | 36 |
33 } // namespace net | 37 } // namespace net |
34 | 38 |
35 #endif // NET_UDP_DATAGRAM_CLIENT_SOCKET_H_ | 39 #endif // NET_UDP_DATAGRAM_CLIENT_SOCKET_H_ |
OLD | NEW |