AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
tcpServer.hpp
1/*
2 ANCH Framework: ANother C++ Hack is a C++ framework based on C++23 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 <https://www.gnu.org/licenses/>.
19*/
20#pragma once
21
22#include "anch-network-export.hpp"
23
24#include <cstddef>
25#include <string>
26
27#include "network/socket.hpp"
28#include "network/tcpStream.hpp"
29
30namespace anch::network {
31
41 class ANCH_NETWORK_EXPORT TcpServer {
42
43 // Attributes +
44 private:
47 // Attributes -
48
49 // Constructors +
50 public:
60 TcpServer(const std::string& host, uint16_t port, int backlog = SOMAXCONN);
61 // Constructors -
62
63 // Methods +
64 public:
75
86
95
102 // Methods -
103
104 };
105
106} // anch::network
Socket address (IPv4 or IPv6 address and port).
Definition address.hpp:54
Network socket (POSIX).
Definition socket.hpp:63
anch::network::Socket & getSocket() noexcept
anch::network::TcpStream accept(std::size_t bufSize=anch::network::TcpStream::DEFAULT_BUFFER_SIZE)
anch::network::Address getAddress() const
TcpServer(const std::string &host, uint16_t port, int backlog=SOMAXCONN)
anch::network::Socket acceptSocket(anch::network::Address *peer=NULL)
TCP connection as a std::iostream.
Definition tcpStream.hpp:59
static constexpr std::size_t DEFAULT_BUFFER_SIZE
Definition tcpStream.hpp:64
Network namespace.
Definition address.hpp:30