12#include <sys/socket.h>
18using SocketHandle = int;
19constexpr SocketHandle INVALID_SOCKET_HANDLE = -1;
20using SocketLength = socklen_t;
28inline void ensureSocketRuntime() {
33inline void closeSocket(SocketHandle socket) { ::close(socket); }
34inline int socketLastError() {
return errno; }
36inline bool socketWouldBlock(
int error) {
37 return error == EWOULDBLOCK || error == EAGAIN;
39inline bool socketConnectionReset(
int error) {
return error == ECONNRESET; }
41inline bool setSocketNonBlocking(SocketHandle socket,
bool enabled =
true) {
42 int flags = fcntl(socket, F_GETFL, 0);
43 return flags >= 0 && fcntl(socket, F_SETFL, enabled ? flags | O_NONBLOCK
44 : flags & ~O_NONBLOCK) == 0;
Definition DesktopSocketPosix.h:22
We provide the WiFi class to simulate the Arduino WIFI. In in Linux we can expect that networking is ...
Definition CanMsg.cpp:31