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.
5 #include "net/udp/udp_client_socket.h"
7 #include "net/base/net_errors.h"
8 #include "net/log/net_log.h"
12 UDPClientSocket::UDPClientSocket(DatagramSocket::BindType bind_type
,
13 const RandIntCallback
& rand_int_cb
,
15 const net::NetLog::Source
& source
)
16 : socket_(bind_type
, rand_int_cb
, net_log
, source
) {
19 UDPClientSocket::~UDPClientSocket() {
22 int UDPClientSocket::Connect(const IPEndPoint
& address
) {
23 int rv
= socket_
.Open(address
.GetFamily());
26 return socket_
.Connect(address
);
29 int UDPClientSocket::Read(IOBuffer
* buf
,
31 const CompletionCallback
& callback
) {
32 return socket_
.Read(buf
, buf_len
, callback
);
35 int UDPClientSocket::Write(IOBuffer
* buf
,
37 const CompletionCallback
& callback
) {
38 return socket_
.Write(buf
, buf_len
, callback
);
41 void UDPClientSocket::Close() {
45 int UDPClientSocket::GetPeerAddress(IPEndPoint
* address
) const {
46 return socket_
.GetPeerAddress(address
);
49 int UDPClientSocket::GetLocalAddress(IPEndPoint
* address
) const {
50 return socket_
.GetLocalAddress(address
);
53 int UDPClientSocket::SetReceiveBufferSize(int32 size
) {
54 return socket_
.SetReceiveBufferSize(size
);
57 int UDPClientSocket::SetSendBufferSize(int32 size
) {
58 return socket_
.SetSendBufferSize(size
);
61 const BoundNetLog
& UDPClientSocket::NetLog() const {
62 return socket_
.NetLog();
66 void UDPClientSocket::UseNonBlockingIO() {
67 socket_
.UseNonBlockingIO();