MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/xstudio / is_socket_alive

Function is_socket_alive

extern/include/cpp-httplib/httplib.h:2435–2444  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2433}
2434
2435inline bool is_socket_alive(socket_t sock) {
2436 const auto val = detail::select_read(sock, 0, 0);
2437 if (val == 0) {
2438 return true;
2439 } else if (val < 0 && errno == EBADF) {
2440 return false;
2441 }
2442 char buf[1];
2443 return detail::read_socket(sock, &buf[0], sizeof(buf), MSG_PEEK) > 0;
2444}
2445
2446class SocketStream : public Stream {
2447public:

Callers 2

is_writableMethod · 0.85
sendMethod · 0.85

Calls 2

select_readFunction · 0.85
read_socketFunction · 0.85

Tested by

no test coverage detected