udp_socket.h
1 
2 #pragma once
3 
4 #include "network_condition_variable.h"
5 #include <memory>
6 #include <vector>
7 
8 namespace uicore
9 {
10  class SocketName;
11 
13  class UDPSocket : public NetworkEvent
14  {
15  public:
17  static std::shared_ptr<UDPSocket> create();
18 
20  virtual void close() = 0;
21 
23  virtual void bind(const SocketName &endpoint) = 0;
24 
26  virtual void send(const void *data, int size, const SocketName &endpoint) = 0;
27 
30  virtual int read(void *data, int size, SocketName &endpoint) = 0;
31  };
32 
33  typedef std::shared_ptr<UDPSocket> UDPSocketPtr;
34 }
UDP/IP socket class.
Definition: udp_socket.h:13
virtual void bind(const SocketName &endpoint)=0
Bind socket to end point.
Socket name; container class for an IP address and port.
Definition: socket_name.h:39
std::shared_ptr< UDPSocket > UDPSocketPtr
Definition: udp_socket.h:33
static std::shared_ptr< UDPSocket > create()
Create socket object.
virtual void close()=0
Close connection.
Base class for all classes that generate network events.
Definition: network_condition_variable.h:14
virtual int read(void *data, int size, SocketName &endpoint)=0
Read receved UDP packet.
virtual void send(const void *data, int size, const SocketName &endpoint)=0
Send UDP packet to end point.
Definition: Application/application.h:35