a file and im saving it on the disk
first 4 byte is file size and the rest is the file itself but when i send it small files like 40KB it works fine but with large files like 1MB it just saves about first 60KB of the file correct and the rest it just puts zeros
does anyone know what is the problem?
read may not read all the data, I think you should call it in a loop until you read file_size bytes (you might try read_to_end, but that has potential to cause oom if the sender lies about file size and sends too much data)
where is read_all defined?
sorry, read_to_end
Обсуждают сегодня