EasySockets v2.0.0
A simple, cross platform socket library for C++.
Loading...
Searching...
No Matches
SocketApi.hpp
1#pragma once
2
3#include "Addresses.hpp"
4#include "SocketTypes.hpp"
5
6namespace es
7{
8 template<typename T>
9 concept SocketApi = requires(T t, EndPoint end_point, char* buffer, int len)
10 {
11 { t.bind_to(end_point) };
12 { t.connect_to(end_point) };
13 { t.listen_for_connections(len) };
14 { t.accept_connection() } -> std::same_as<T>;
15 { t.receive_data(buffer, len) } -> std::same_as<int64_t>;
16 { t.receive_data_from(buffer, len, end_point) } -> std::same_as<int64_t>;
17 { t.send_data(buffer, len) } -> std::same_as<int64_t>;
18 { t.send_data_to(buffer, len, end_point) } -> std::same_as<int64_t>;
19 }
20 && std::constructible_from<T, IpVersion, Protocol>
21 && !std::copyable<T>
22 && std::movable<T>;
23}
Definition SocketApi.hpp:9
Definition Addresses.hpp:7
Represents the address + port that identifies a connection. Initialized by {Address,...
Definition Addresses.hpp:29