MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / sendBuffer

Method sendBuffer

bots/cplusplus/rcbot/RCBot.cpp:344–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342*/
343
344bool RCLinkBot::sendBuffer(const char* message) {
345 unsigned int messagelen = (unsigned int)strlen(message);
346
347 if (output_overflow) {
348 error = "Output overflow! (more data than buffer can take)";
349 return false;
350 }
351
352 if (send_amount + messagelen > RC_LINK_SENDBUFLEN) {
353 std::cout << "RCLink: Setting output_overflow." << std::endl;
354 error = "Output overflow! (more data than the buffer can take)";
355 output_overflow = true;
356 return false;
357 }
358
359 memcpy(sendbuf + send_amount, message, messagelen);
360#ifdef PROTOCOL_DEBUG
361 std::cout << "[ send] " << (sendbuf + send_amount); std::cout.flush();
362#endif
363 send_amount += messagelen;
364
365 updateWrite();
366 return true;
367}
368
369void RCLinkBot::sendPacket(const char* data, unsigned int size, bool killit) {
370 send(connfd, data, size, 0);

Callers

nothing calls this directly

Calls 1

flushMethod · 0.45

Tested by

no test coverage detected