MCPcopy Create free account
hub / github.com/FastLED/FastLED / isSocketConnected

Method isSocketConnected

src/fl/stl/asio/http/native_server.cpp.hpp:227–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225}
226
227bool NativeHttpServer::isSocketConnected(const asio::ip::tcp::socket& sock) const {
228 if (!sock.is_open()) {
229 return false;
230 }
231
232 // Check socket status using getsockopt
233 int error = 0;
234 socklen_t len = sizeof(error);
235 int ret = getsockopt(sock.native_handle(), SOL_SOCKET, SO_ERROR, (char*)&error, &len);
236
237 if (ret != 0 || error != 0) {
238 return false;
239 }
240
241 return true;
242}
243
244} // namespace fl
245

Callers

nothing calls this directly

Calls 3

getsockoptFunction · 0.50
is_openMethod · 0.45
native_handleMethod · 0.45

Tested by

no test coverage detected