AnCH Framework 0.1
Another C++ Hack Framework
 
Loading...
Searching...
No Matches
tcpStream.hpp
1/*
2 ANCH Framework: ANother C++ Hack is a C++ framework based on C++11 standard
3 Copyright (C) 2012 Vincent Lachenal
4
5 This file is part of ANCH Framework.
6
7 ANCH Framework is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 ANCH Framework is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with ANCH Framework. If not, see <http://www.gnu.org/licenses/>.
19*/
20#pragma once
21
22#include "network/tcpSocket.hpp"
23#include "cutils/iostream.hpp"
24
25namespace anch::network {
26
35
36 // Attributes +
37 protected:
40
43 // Attributes -
44
45 // Constructors +
46 public:
56 TcpStream(const std::string& ipAddress, uint16_t port, std::size_t bufSize = 1500);
57 // Constructors -
58
59 // Destructor +
60 public:
64 virtual ~TcpStream() noexcept;
65 // Destructor -
66
67 public:
68 inline bool addObserver(anch::events::Observer<anch::network::SocketEvent>& observer) {
69 return _socket.addObserver(observer);
70 }
71
72 };
73
81 class TcpStreamServer: public TcpStream {
82
83 // Constructors +
84 public:
94 TcpStreamServer(const std::string& ipAddress, uint16_t port, std::size_t bufSize = 1500);
95 // Constructors -
96
97 // Destructor +
98 public:
102 virtual ~TcpStreamServer() noexcept;
103 // Destructor -
104
105 };
106
115
116 // Constructors +
117 public:
127 TcpStreamClient(const std::string& ipAddress, uint16_t port, std::size_t bufSize = 1500);
128 // Constructors -
129
130 // Destructor +
131 public:
135 virtual ~TcpStreamClient() noexcept;
136 // Destructor -
137
138 };
139
140} // anch::network
Definition iostream.hpp:269
Definition socketEvent.hpp:35
Definition tcpSocket.hpp:33
TcpStreamClient(const std::string &ipAddress, uint16_t port, std::size_t bufSize=1500)
virtual ~TcpStreamClient() noexcept
TcpStream(const std::string &ipAddress, uint16_t port, std::size_t bufSize=1500)
anch::network::TcpSocket _socket
Definition tcpStream.hpp:39
anch::cutils::cbuffer _buffer
Definition tcpStream.hpp:42
virtual ~TcpStream() noexcept
virtual ~TcpStreamServer() noexcept
TcpStreamServer(const std::string &ipAddress, uint16_t port, std::size_t bufSize=1500)
Events management namespace.
Definition event.hpp:25
Network namespace.
Definition ioException.hpp:25
AnCH framework base namespace.
Definition app.hpp:28
C buffer.
Definition iostream.hpp:58