MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / send_all

Function send_all

app/server/http.cpp:129–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127 SocketHandle socket_ = kInvalidSocket;
128};
129
130void send_all(SocketHandle socket, const std::string & data) {
131 size_t offset = 0;
132 while (offset < data.size()) {
133 const auto remaining = data.size() - offset;
134#ifdef _WIN32
135 const int written = send(
136 socket,
137 data.data() + offset,
138 static_cast<int>(std::min<size_t>(remaining, std::numeric_limits<int>::max())),
139 0);
140#else
141 const ssize_t written = send(socket, data.data() + offset, remaining, 0);
142#endif
143 if (written <= 0) {
144 throw std::runtime_error("socket send failed");
145 }
146 offset += static_cast<size_t>(written);
147 }
148}
149
150HttpRequest read_http_request(SocketHandle socket) {

Callers 1

handle_clientFunction · 0.85

Calls 3

maxFunction · 0.85
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected