| 560 | } |
| 561 | |
| 562 | size_t SendData(const void* buffer, size_t size) override |
| 563 | { |
| 564 | if (_status != SocketStatus::connected) |
| 565 | { |
| 566 | throw std::runtime_error("Socket not connected."); |
| 567 | } |
| 568 | |
| 569 | size_t totalSent = 0; |
| 570 | do |
| 571 | { |
| 572 | const char* bufferStart = static_cast<const char*>(buffer) + totalSent; |
| 573 | size_t remainingSize = size - totalSent; |
| 574 | int32_t sentBytes = send(_socket, bufferStart, static_cast<int32_t>(remainingSize), FLAG_NO_PIPE); |
| 575 | if (sentBytes == SOCKET_ERROR) |
| 576 | { |
| 577 | return totalSent; |
| 578 | } |
| 579 | totalSent += sentBytes; |
| 580 | } while (totalSent < size); |
| 581 | return totalSent; |
| 582 | } |
| 583 | |
| 584 | ReadPacket ReceiveData(void* buffer, size_t size, size_t* sizeReceived) override |
| 585 | { |
no outgoing calls
no test coverage detected