MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / SendData

Method SendData

src/openrct2/network/Socket.cpp:562–582  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 4

sendQueuedDataMethod · 0.45
updateLANMethod · 0.45
writeMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected