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_UDP_SOCKET_H_ | 5 #ifndef NET_UDP_UDP_SOCKET_H_ |
6 #define NET_UDP_UDP_SOCKET_H_ | 6 #define NET_UDP_UDP_SOCKET_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #if defined(OS_WIN) | 10 #if defined(OS_NACL) |
| 11 #include "net/udp/udp_socket_nacl.h" |
| 12 #elif defined(OS_WIN) |
11 #include "net/udp/udp_socket_win.h" | 13 #include "net/udp/udp_socket_win.h" |
12 #elif defined(OS_POSIX) | 14 #elif defined(OS_POSIX) |
13 #include "net/udp/udp_socket_libevent.h" | 15 #include "net/udp/udp_socket_libevent.h" |
14 #endif | 16 #endif |
15 | 17 |
16 namespace net { | 18 namespace net { |
17 | 19 |
18 // UDPSocket | 20 // UDPSocket |
19 // Accessor API for a UDP socket in either client or server form. | 21 // Accessor API for a UDP socket in either client or server form. |
20 // | 22 // |
21 // Client form: | 23 // Client form: |
22 // In this case, we're connecting to a specific server, so the client will | 24 // In this case, we're connecting to a specific server, so the client will |
23 // usually use: | 25 // usually use: |
24 // Connect(address) // Connect to a UDP server | 26 // Connect(address) // Connect to a UDP server |
25 // Read/Write // Reads/Writes all go to a single destination | 27 // Read/Write // Reads/Writes all go to a single destination |
26 // | 28 // |
27 // Server form: | 29 // Server form: |
28 // In this case, we want to read/write to many clients which are connecting | 30 // In this case, we want to read/write to many clients which are connecting |
29 // to this server. First the server 'binds' to an addres, then we read from | 31 // to this server. First the server 'binds' to an addres, then we read from |
30 // clients and write responses to them. | 32 // clients and write responses to them. |
31 // Example: | 33 // Example: |
32 // Bind(address/port) // Binds to port for reading from clients | 34 // Bind(address/port) // Binds to port for reading from clients |
33 // RecvFrom/SendTo // Each read can come from a different client | 35 // RecvFrom/SendTo // Each read can come from a different client |
34 // // Writes need to be directed to a specific | 36 // // Writes need to be directed to a specific |
35 // // address. | 37 // // address. |
36 #if defined(OS_WIN) | 38 #if defined(OS_NACL) |
| 39 typedef UDPSocketNacl UDPSocket; |
| 40 #elif defined(OS_WIN) |
37 typedef UDPSocketWin UDPSocket; | 41 typedef UDPSocketWin UDPSocket; |
38 #elif defined(OS_POSIX) | 42 #elif defined(OS_POSIX) |
39 typedef UDPSocketLibevent UDPSocket; | 43 typedef UDPSocketLibevent UDPSocket; |
40 #endif | 44 #endif |
41 | 45 |
42 } // namespace net | 46 } // namespace net |
43 | 47 |
44 #endif // NET_UDP_UDP_SOCKET_H_ | 48 #endif // NET_UDP_UDP_SOCKET_H_ |
OLD | NEW |