EHS
Loading...
Searching...
No Matches
TCP_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 "ehs/Log.h"
6
7#include "Socket.h"
8#include "BaseTCP.h"
9
10namespace ehs
11{
13 class EHS_LIB_IO TCP : public BaseTCP
14 {
15 protected:
16 Socket hdl;
17
18 public:
20 ~TCP() override;
21
23 TCP();
24
26
27 TCP(TCP&& tcp) noexcept;
28
31 TCP(const TCP& tcp);
32
33 TCP& operator=(TCP&& tcp) noexcept;
34
38 TCP& operator=(const TCP& tcp);
39
40 void Initialize() override;
41
43 void Release() override;
44
49 void Bind(const Str_8& address, UInt_16 port) override;
50
52 void Listen() override;
53
56 TCP* Accept() override;
57
61 void Connect(const Str_8& address, UInt_16 port) override;
62
67 UInt_64 Send(const Byte* buffer, UInt_32 size) override;
68
73 UInt_64 Receive(Byte* buffer, UInt_32 size) override;
74
77 void SetBlocking(bool blocking) override;
78
81 bool IsBlocking() const override;
82
83 void SetIPv6Only(bool value) override;
84
85 bool IsIPv6Only() const override;
86
87 bool IsValid() const override;
88
89 private:
90 void Bind_v6(const Str_8& address, UInt_16 port);
91
92 void Bind_v4(const Str_8& address, UInt_16 port);
93
94 void Connect_v6(const Str_8& address, UInt_16 port);
95
96 void Connect_v4(const Str_8& address, UInt_16 port);
97 };
98}
Definition BaseTCP.h:13
A wrapper class for the transmission control protocol socket.
Definition TCP_BSD.h:14
void Listen() override
Listens for incoming connections. Used for servers or PtP.
bool IsIPv6Only() const override
TCP(IP IP)
void Initialize() override
Explicitly initialize the socket.
~TCP() override
Frees any native handles.
void Release() override
Frees native handles and uninitializes them.
bool IsBlocking() const override
UInt_64 Receive(Byte *buffer, UInt_32 size) override
TCP()
Default members initialization.
TCP & operator=(TCP &&tcp) noexcept
TCP * Accept() override
TCP & operator=(const TCP &tcp)
UInt_64 Send(const Byte *buffer, UInt_32 size) override
void Connect(const Str_8 &address, UInt_16 port) override
TCP(const TCP &tcp)
TCP(TCP &&tcp) noexcept
void Bind(const Str_8 &address, UInt_16 port) override
void SetIPv6Only(bool value) override
bool IsValid() const override
void SetBlocking(bool blocking) override
Definition Anchor.h:6
unsigned int UInt_32
Definition Types.h:49
IP
Definition Socket.h:29
Str< Char_8, UInt_64 > Str_8
Definition Str.h:1953
unsigned char Byte
Definition Types.h:39
unsigned short UInt_16
Definition Types.h:46