udp_socket.h Source File - ClanLib SDK
Description: udp_socket.h Source File

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:
18 UDPSocket();
19
20 ~UDPSocket();
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}
clan::NetworkEvent
Base class for all classes that generate network events.
Definition network_condition_variable.h:15
clan::SocketName
Socket name; container class for an IP address and port.
Definition socket_name.h:45
clan::UDPSocket
UDP/IP socket class.
Definition udp_socket.h:15
clan::UDPSocket::~UDPSocket
~UDPSocket()
clan::UDPSocket::UDPSocket
UDPSocket()
Create socket object.
clan::UDPSocket::get_socket_handle
SocketHandle * get_socket_handle() override
clan::UDPSocket::send
void send(const void *data, int size, const SocketName &endpoint)
Send UDP packet to end point.
clan::UDPSocket::close
void close()
Close connection.
clan::UDPSocket::bind
void bind(const SocketName &endpoint)
Bind socket to end point.
clan::UDPSocket::read
int read(void *data, int size, SocketName &endpoint)
Read receved UDP packet.
clan
Definition clanapp.h:36