the following code works perfectly well for smaller files (1-10MB), but when I try to send bigger files (I tested with a 7GB file) then TransmitFile returns false, and WSAGetLastError() returns 87. I don't really know what to do with that error code (Wrong Parameters) since nothing about the parameters changes. Does somebody know under what circumstances TransmitFile complains about wrrong parameters when the file size changes?
void send_file(int socket, std::string& src_file) {
const auto file_size = std::filesystem::file_size(src_file);
if(!(send_uint64(socket, file_size) == sizeof(static_cast<uint64_t>(file_size))))
throw WSA_socket_exception(WSAGetLastError(), socket);
const auto file = reinterpret_cast<HANDLE>(_get_osfhandle(_fileno(fopen(src_file.c_str(), "r"))));
if (!TransmitFile(socket, file, 0, static_cast<DWORD>(MAX_BUFFER_FILE), nullptr, nullptr, 0)) {
throw WSA_socket_exception(WSAGetLastError(), socket);
}
}