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_SOCKET_UDP_CLIENT_SOCKET_H_ 6 #define NET_SOCKET_UDP_CLIENT_SOCKET_H_ 7 #pragma once 8 9 #include "net/base/net_log.h" 10 #include "net/udp/datagram_client_socket.h" 11 #include "net/udp/udp_socket.h" 12 13 namespace net { 14 15 class BoundNetLog; 16 17 // A client socket that uses UDP as the transport layer. 18 class UDPClientSocket : public DatagramClientSocket { 19 public: 20 UDPClientSocket(net::NetLog* net_log, 21 const net::NetLog::Source& source); 22 virtual ~UDPClientSocket(); 23 24 // Implement DatagramClientSocket: 25 virtual int Connect(const IPEndPoint& address); 26 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); 27 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); 28 virtual void Close(); 29 virtual int GetPeerAddress(IPEndPoint* address) const; 30 virtual int GetLocalAddress(IPEndPoint* address) const; 31 virtual bool SetReceiveBufferSize(int32 size); 32 virtual bool SetSendBufferSize(int32 size); 33 34 private: 35 UDPSocket socket_; 36 DISALLOW_COPY_AND_ASSIGN(UDPClientSocket); 37 }; 38 39 } // namespace net 40 41 #endif // NET_SOCKET_UDP_CLIENT_SOCKET_H_ 42