| 342 | */ |
| 343 | |
| 344 | bool 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 | |
| 369 | void RCLinkBot::sendPacket(const char* data, unsigned int size, bool killit) { |
| 370 | send(connfd, data, size, 0); |