EHS
Loading...
Searching...
No Matches
UDP_W32.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(const IP IP);
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);
79
80 void Bind_v4(const Str_8& address, UInt_16 port);
81
82 UInt_64 Send_v6(const Str_8& addr, UInt_16 port, const Byte* data, UInt_64 size);
83
84 UInt_64 Send_v4(const Str_8& addr, 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
void SetBlocking(bool blocking) override
void SetIPv6Only(bool value) override
void Bind(const Endpoint &endpoint) override
UDP(UDP &&udp) noexcept
bool IsIPv6Only() const override
UDP & operator=(const UDP &udp)
~UDP() override
Frees any native handles.
UInt_64 Send(const Endpoint &endpoint, const Byte *data, UInt_64 size) override
void Release() override
Frees native handles and uninitializes them.
bool IsBlocking() const override
UDP(const UDP &udp)
UDP(const IP IP)
Default members initialization.
UInt_64 Receive(Endpoint *endpoint, Byte *data, UInt_64 size) override
UDP & operator=(UDP &&udp) noexcept
bool IsValid() const override
Definition Anchor.h:6
IP
Definition Socket.h:29
Str< Char_8, UInt_64 > Str_8
Definition Str.h:1902
unsigned char Byte
Definition Types.h:39
unsigned short UInt_16
Definition Types.h:46
Definition Socket.h:48