AnCH Framework 0.1
Another C++ Hack Framework
 
Loading...
Searching...
No Matches
tcpSocket.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/socket.hpp"
23
24namespace anch::network {
25
26 class TcpStream;
27
34
36
37 public:
38 // Constructors +
43
52 TcpSocket(const std::string& ipAddress, uint16_t port);
53 // Constructors -
54
55 // Destructor +
59 virtual ~TcpSocket() noexcept;
60 // Destructor -
61
62 public:
63 // Methods +
71 virtual void send(const std::string& message);
72
80 virtual void receive(std::string& message);
81
82 private:
91 std::size_t write(const char* buffer, std::size_t size);
92
101 std::size_t read(char* buffer, std::size_t size);
102 // Methods -
103
104 // Accessors +
110 virtual int getDomain() const;
111
117 virtual int getType() const;
118 // Accessors -
119
120 };
121
122}
Definition socket.hpp:91
virtual void send(const std::string &message)
virtual void receive(std::string &message)
TcpSocket(const std::string &ipAddress, uint16_t port)
virtual ~TcpSocket() noexcept
Definition tcpStream.hpp:34
Network namespace.
Definition ioException.hpp:25