Ocean
UDPClient.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef FACEBOOK_NETWORK_UDP_CLIENT_H
9 #define FACEBOOK_NETWORK_UDP_CLIENT_H
10 
11 #include "ocean/network/Network.h"
13 
14 namespace Ocean
15 {
16 
17 namespace Network
18 {
19 
20 /**
21  * This class implements a UDP client.
22  * @ingroup network
23  */
24 class OCEAN_NETWORK_EXPORT UDPClient : virtual public ConnectionlessClient
25 {
26  public:
27 
28  /**
29  * Creates a new UDP client object.
30  */
32 
33  /**
34  * Destructs a UDP client object.
35  */
36  ~UDPClient() override;
37 
38  protected:
39 
40  /**
41  * Build the UDP socket.
42  * @param localAddress The local address to which the socket will be bound, a default address to bound the socket to any local address
43  * @param localPort The local port to which the socket will be bound, a default port to bound the socket to any free port
44  * @return True, if succeeded
45  */
46  bool buildSocket(const Address4& localAddress = Address4(), const Port localPort = Port());
47 };
48 
49 }
50 
51 }
52 
53 #endif // FACEBOOK_NETWORK_UDP_SOCKET_H
This class wraps an address number with 32 bits.
Definition: Address4.h:26
This class is the base class for all connectionless clients.
Definition: ConnectionlessClient.h:27
This class wraps a port number with 16 bits.
Definition: Port.h:26
This class implements a UDP client.
Definition: UDPClient.h:25
~UDPClient() override
Destructs a UDP client object.
bool buildSocket(const Address4 &localAddress=Address4(), const Port localPort=Port())
Build the UDP socket.
UDPClient()
Creates a new UDP client object.
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15