EHS
TCP_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 "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
25 TCP(IP IP);
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
Socket hdl
Definition: TCP_BSD.h:16
Definition: Anchor.h:6
unsigned int UInt_32
Definition: Types.h:49
IP
Definition: Socket.h:29
EHS_LIB_IO void Initialize(Str_8 appName, Str_8 appVerId, const Version &appVer)
Definition: EHS.cpp:34
unsigned char Byte
Definition: Types.h:39
unsigned short UInt_16
Definition: Types.h:46