EHS
UDP_BSD.h
Go to the documentation of this file.
1#pragma once
2
3#include "ehs/EHS.h"
4#include "ehs/Str.h"
5#include "BaseUDP.h"
6
7namespace ehs
8{
10 class EHS_LIB_IO UDP : public BaseUDP
11 {
12 private:
13 Socket hdl;
14
15 public:
17 ~UDP() override;
18
19 UDP();
20
22 UDP(IP version);
23
24 UDP(UDP&& udp) noexcept;
25
28 UDP(const UDP& udp);
29
30 UDP& operator=(UDP&& udp) noexcept;
31
35 UDP& operator=(const UDP& udp);
36
38 void Release() override;
39
44 void Bind(const Endpoint &endpoint) override;
45
52 UInt_64 Send(const Endpoint &endpoint, const Byte* data, UInt_64 size) override;
53
61 UInt_64 Receive(Endpoint *endpoint, Byte* data, UInt_64 size) override;
62
65 void SetBlocking(bool blocking) override;
66
69 bool IsBlocking() const override;
70
71 void SetIPv6Only(bool value) override;
72
73 bool IsIPv6Only() const override;
74
75 bool IsValid() const override;
76
77 private:
78 void Bind_v6(const Str_8& address, UInt_16 port) const;
79
80 void Bind_v4(const Str_8& address, UInt_16 port) const;
81
82 UInt_64 Send_v6(const Str_8& address, UInt_16 port, const Byte* data, UInt_64 size);
83
84 UInt_64 Send_v4(const Str_8& address, UInt_16 port, const Byte* data, UInt_64 size);
85 };
86}
Definition: BaseUDP.h:10
A wrapper class for the user datagram protocol socket.
Definition: UDP_BSD.h:11
Definition: Anchor.h:6
IP
Definition: Socket.h:29
unsigned char Byte
Definition: Types.h:39
unsigned short UInt_16
Definition: Types.h:46
Definition: Socket.h:48