| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_UDP_DATAGRAM_CLIENT_SOCKET_H_ | |
| 6 #define NET_UDP_DATAGRAM_CLIENT_SOCKET_H_ | |
| 7 | |
| 8 #include "net/base/net_export.h" | |
| 9 #include "net/base/network_change_notifier.h" | |
| 10 #include "net/socket/socket.h" | |
| 11 #include "net/udp/datagram_socket.h" | |
| 12 | |
| 13 namespace net { | |
| 14 | |
| 15 class IPEndPoint; | |
| 16 | |
| 17 class NET_EXPORT_PRIVATE DatagramClientSocket : public DatagramSocket, | |
| 18 public Socket { | |
| 19 public: | |
| 20 ~DatagramClientSocket() override {} | |
| 21 | |
| 22 // Initialize this socket as a client socket to server at |address|. | |
| 23 // Returns a network error code. | |
| 24 virtual int Connect(const IPEndPoint& address) = 0; | |
| 25 | |
| 26 // Binds this socket to |network| and initializes socket as a client socket | |
| 27 // to server at |address|. All data traffic on the socket will be sent and | |
| 28 // received via |network|. This call will fail if |network| has disconnected. | |
| 29 // Communication using this socket will fail if |network| disconnects. | |
| 30 // Returns a net error code. | |
| 31 virtual int ConnectUsingNetwork(NetworkChangeNotifier::NetworkHandle network, | |
| 32 const IPEndPoint& address) = 0; | |
| 33 | |
| 34 // Same as ConnectUsingNetwork, except that the current default network is | |
| 35 // used. Returns a net error code. | |
| 36 virtual int ConnectUsingDefaultNetwork(const IPEndPoint& address) = 0; | |
| 37 | |
| 38 // Returns the network that either ConnectUsingNetwork() or | |
| 39 // ConnectUsingDefaultNetwork() bound this socket to. Returns | |
| 40 // NetworkChangeNotifier::kInvalidNetworkHandle if not explicitly bound via | |
| 41 // ConnectUsingNetwork() or ConnectUsingDefaultNetwork(). | |
| 42 virtual NetworkChangeNotifier::NetworkHandle GetBoundNetwork() const = 0; | |
| 43 | |
| 44 }; | |
| 45 | |
| 46 } // namespace net | |
| 47 | |
| 48 #endif // NET_UDP_DATAGRAM_CLIENT_SOCKET_H_ | |
| OLD | NEW |