1
0
Fork 0
mirror of https://gitlab.com/niansa/llama_nds.git synced 2025-03-06 20:53:28 +01:00
llama_nds/Sender.cpp
2023-04-03 22:06:29 +02:00

24 lines
619 B
C++

#include "Runtime.hpp"
#include "Sender.hpp"
#include <string_view>
#ifndef PLATFORM_WINDOWS
# include <sys/socket.h>
# include <sys/select.h>
#else
# include <ws2tcpip.h>
# include <winsock2.h>
#endif
void Sender::Simple::write(std::string_view str, bool moreData) {
this->write(reinterpret_cast<const std::byte*>(str.data()), str.size(), moreData);
}
void Sender::Simple::write(const std::byte *data, size_t size, bool moreData) {
std::string fres;
// Write
send(fd, reinterpret_cast<const char*>(data), size, MSG_FLAGS_OR_ZERO(MSG_WAITALL | MSG_NOSIGNAL | (int(moreData)*MSG_MORE)));
}