The ultimate socket library for C and C++, supporting TCP, UDP and Unix sockets (DGRAM and STREAM) on Linux, FreeBSD, Solaris. See also my uvco library for a refreshed version!
➜ examples++ git:(master) ✗ ls
a.out echo_client_conn.cpp framing.cpp http_epoll.cpp server.cpp unix_dgram_client.cpp unix_server_stream.cpp
client.cpp echo_client_sndto.cpp http_2.cpp libsocket++.a test.sh unix_dgram_server.cpp
dgram_over_stream.cpp echo_server.cpp http.cpp libsocket++.so unix_client_stream.cpp unix_dgram_syslogclient.cpp
➜ examples++ git:(master) ✗ g++ http_epoll.cpp -std=c++17 -lsocket++
In file included from http_epoll.cpp:3:
../headers/epoll.hpp: In destructor ‘libsocket::epollset<SocketT>::~epollset()’:
../headers/epoll.hpp:127:5: error: there are no arguments to ‘close’ that depend on a template parameter, so a declaration of ‘close’ must be available [-fpermissive]
127 | close(epollfd);
| ^~~~~
../headers/epoll.hpp:127:5: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
http_epoll.cpp: In function ‘int main()’:
http_epoll.cpp:35:36: error: use of deleted function ‘libsocket::inet_stream& libsocket::inet_stream::operator=(const libsocket::inet_stream&)’
35 | sock = *(ready.first[0]);
| ^
In file included from http_epoll.cpp:5:
../headers/inetclientstream.hpp:54:7: note: ‘libsocket::inet_stream& libsocket::inet_stream::operator=(const libsocket::inet_stream&)’ is implicitly deleted because the default definition would be ill-formed:
54 | class inet_stream : public inet_socket, public stream_client_socket {
| ^~~~~~~~~~~
../headers/inetclientstream.hpp:54:7: error: use of deleted function ‘libsocket::inet_socket& libsocket::inet_socket::operator=(const libsocket::inet_socket&)’
In file included from ../headers/inetclientstream.hpp:8,
from http_epoll.cpp:5:
../headers/inetbase.hpp:52:7: note: ‘libsocket::inet_socket& libsocket::inet_socket::operator=(const libsocket::inet_socket&)’ is implicitly deleted because the default definition would be ill-formed:
52 | class inet_socket : public virtual socket {
| ^~~~~~~~~~~
../headers/inetbase.hpp:52:7: error: use of deleted function ‘constexpr libsocket::socket& libsocket::socket::operator=(const libsocket::socket&)’
In file included from ../headers/epoll.hpp:45,
from http_epoll.cpp:3:
../headers/socket.hpp:71:7: note: ‘constexpr libsocket::socket& libsocket::socket::operator=(const libsocket::socket&)’ is implicitly declared as deleted because ‘libsocket::socket’ declares a move constructor or move assignment operator
71 | class socket {
| ^~~~~~
In file included from http_epoll.cpp:5:
../headers/inetclientstream.hpp:54:7: error: use of deleted function ‘libsocket::stream_client_socket& libsocket::stream_client_socket::operator=(const libsocket::stream_client_socket&)’
54 | class inet_stream : public inet_socket, public stream_client_socket {
| ^~~~~~~~~~~
In file included from ../headers/inetclientstream.hpp:9,
from http_epoll.cpp:5:
../headers/streamclient.hpp:52:7: note: ‘libsocket::stream_client_socket& libsocket::stream_client_socket::operator=(const libsocket::stream_client_socket&)’ is implicitly declared as deleted because ‘libsocket::stream_client_socket’ declares a move constructor or move assignment operator
52 | class stream_client_socket : public virtual socket {
| ^~~~~~~~~~~~~~~~~~~~
In file included from http_epoll.cpp:3:
../headers/epoll.hpp: In instantiation of ‘libsocket::epollset<SocketT>::~epollset() [with SocketT = libsocket::inet_stream]’:
http_epoll.cpp:23:31: required from here
../headers/epoll.hpp:127:10: error: ‘close’ was not declared in this scope; did you mean ‘pclose’?
127 | close(epollfd);
| ~~~~~^~~~~~~~~
| pclose
➜ examples++ git:(master) ✗