c++ - Linux server, upload a file to windows client (Socket) -
when send file client gets corrupted, , size in bytes higher. i have version of server running on windows , works perfectly,but i'm not having same result on linux. the file size on disk may error in time send size in bytes client runs on platform? fread function being used correctly? an expert can analyze , find error? linux server side // function upload file client windows int socket_setup::file_upload(int id, std::string dir_upload) { char block[1024]; long filesize; int bytesread; fp = fopen(dir_upload.c_str(), "rb"); if (!fp) { errno_message.append((char*)strerror(errno)); function_log(errno_message); return 1; } fseek(fp, 0, seek_end); filesize = ftell(fp); rewind(fp); long size_send = htonl(filesize); total = filesize; // sending file size windows client iresult = send(client[id].socket, (const char*)&size_send, sizeof(long), 0); if (i...