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

Method recv

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

Source from the content-addressed store, hash-verified

116}
117
118int NativeHttpServer::recv(u32 clientId, fl::span<u8> buffer) {
119 ServerClientConnection* client = findClient(clientId);
120 if (!client || !client->socket.is_open()) {
121 return -1;
122 }
123
124 asio::error_code ec;
125 size_t n = client->socket.read_some(buffer, ec);
126
127 if (ec) {
128 if (ec.code == asio::errc::would_block) {
129 return 0; // Non-blocking socket, no data available
130 }
131 // Connection error or EOF, disconnect client
132 client->connection.onDisconnected();
133 return -1;
134 }
135
136 // Data received, update heartbeat tracking
137 client->connection.onHeartbeatReceived();
138
139 return static_cast<int>(n);
140}
141
142void NativeHttpServer::broadcast(fl::span<const u8> data) {
143 // Send to all clients

Callers

nothing calls this directly

Calls 4

read_someMethod · 0.80
onDisconnectedMethod · 0.80
is_openMethod · 0.45
onHeartbeatReceivedMethod · 0.45

Tested by

no test coverage detected