EasySockets v2.0.0
A simple, cross platform socket library for C++.
Loading...
Searching...
No Matches
EasySockets.hpp
1#pragma once
2
3#include "Api/SocketApi.hpp"
4#include "Api/ContextApi.hpp"
5#include "Api/Documentation.hpp"
6
7#if defined(_WIN32)
8
9 #include "Windows/WindowsSocket.hpp"
10 #include "Windows/WinsockContext.hpp"
11
12 #define SOCKET_TYPE WindowsSocket
13 #define CONTEXT_TYPE WinsockContext
14
15#elif defined(__unix__) || defined(__unix) || defined(__APPLE__)
16
17 #include "Posix/PosixSocket.hpp"
18 #include "Posix/PosixContext.hpp"
19
20 #define SOCKET_TYPE PosixSocket
21 #define CONTEXT_TYPE PosixContext
22
23#else
24
25 #error EasySockets does not support this platform
26
27#endif
28
29namespace es
30{
38 ES_API_DOC(socket)
50 using Socket = SOCKET_TYPE;
51
59 ES_API_DOC(context)
71 using Context = CONTEXT_TYPE;
72}
73
74static_assert(es::SocketApi<es::Socket>,
75 "Socket API for current platform is invalid. This problem is the library's fault, not the end user's.");
76static_assert(es::ContextApi<es::Context>,
77 "Context API for current platform is invalid. This problem is the library's fault, not the end user's.");
Definition ContextApi.hpp:8
Definition SocketApi.hpp:9
WinsockContext Context
An object which is required to exist for es::Sockets to be used.
Definition EasySockets.hpp:71
WindowsSocket Socket
An object which represents a connection between two applications.
Definition EasySockets.hpp:50
Definition Addresses.hpp:7