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 #include "net/udp/udp_client_socket.h" | |
6 | |
7 #include "net/base/net_errors.h" | |
8 #include "net/base/net_log.h" | |
9 | |
10 namespace net { | |
11 | |
12 UDPClientSocket::UDPClientSocket(DatagramSocket::BindType bind_type, | |
13 const RandIntCallback& rand_int_cb, | |
14 net::NetLog* net_log, | |
15 const net::NetLog::Source& source) | |
16 : socket_(bind_type, rand_int_cb, net_log, source) { | |
17 } | |
18 | |
19 UDPClientSocket::~UDPClientSocket() { | |
20 } | |
21 | |
22 int UDPClientSocket::Connect(const IPEndPoint& address) { | |
23 int rv = socket_.Open(address.GetFamily()); | |
24 if (rv != OK) | |
25 return rv; | |
26 return socket_.Connect(address); | |
27 } | |
28 | |
29 int UDPClientSocket::Read(IOBuffer* buf, | |
30 int buf_len, | |
31 const CompletionCallback& callback) { | |
32 return socket_.Read(buf, buf_len, callback); | |
33 } | |
34 | |
35 int UDPClientSocket::Write(IOBuffer* buf, | |
36 int buf_len, | |
37 const CompletionCallback& callback) { | |
38 return socket_.Write(buf, buf_len, callback); | |
39 } | |
40 | |
41 void UDPClientSocket::Close() { | |
42 socket_.Close(); | |
43 } | |
44 | |
45 int UDPClientSocket::GetPeerAddress(IPEndPoint* address) const { | |
46 return socket_.GetPeerAddress(address); | |
47 } | |
48 | |
49 int UDPClientSocket::GetLocalAddress(IPEndPoint* address) const { | |
50 return socket_.GetLocalAddress(address); | |
51 } | |
52 | |
53 int UDPClientSocket::SetReceiveBufferSize(int32 size) { | |
54 return socket_.SetReceiveBufferSize(size); | |
55 } | |
56 | |
57 int UDPClientSocket::SetSendBufferSize(int32 size) { | |
58 return socket_.SetSendBufferSize(size); | |
59 } | |
60 | |
61 const BoundNetLog& UDPClientSocket::NetLog() const { | |
62 return socket_.NetLog(); | |
63 } | |
64 | |
65 #if defined(OS_WIN) | |
66 void UDPClientSocket::UseNonBlockingIO() { | |
67 socket_.UseNonBlockingIO(); | |
68 } | |
69 #endif | |
70 | |
71 } // namespace net | |
OLD | NEW |