udp_socket.h
1
2#pragma once
3
4#include "network_condition_variable.h"
5#include <memory>
6#include <vector>
7
8namespace clan
9{
10 class SocketName;
11 class UDPSocketImpl;
12
14 class UDPSocket : public NetworkEvent
15 {
16 public:
19
21
23 void close();
24
26 void bind(const SocketName &endpoint);
27
29 void send(const void *data, int size, const SocketName &endpoint);
30
33 int read(void *data, int size, SocketName &endpoint);
34
35 protected:
36 SocketHandle *get_socket_handle() override;
37
38 private:
39 std::shared_ptr<UDPSocketImpl> impl;
40 };
41}
Base class for all classes that generate network events.
Definition network_condition_variable.h:15
Socket name; container class for an IP address and port.
Definition socket_name.h:45
UDP/IP socket class.
Definition udp_socket.h:15
UDPSocket()
Create socket object.
SocketHandle * get_socket_handle() override
void send(const void *data, int size, const SocketName &endpoint)
Send UDP packet to end point.
void close()
Close connection.
void bind(const SocketName &endpoint)
Bind socket to end point.
int read(void *data, int size, SocketName &endpoint)
Read receved UDP packet.
Definition clanapp.h:36