TCP protocol to transfer large files when reading problems

TCP protocol to transfer large files when reading problems

大文件传不完的bug

When we defined the definition of the server each time a file is read size 10240,

Each time the client accepts size10240

We granted that every client read size is 10240 and the reading down the client's file size each time plus the granted10240

In fact the server to send the file each time you send is not necessarily a one-time send to 10240 file transfer is complete, it may be divided several times we were sent to a buffer that is not necessarily the actual file size10240

Solution:

1. For each size and content of the document sent by the server are sent to the client, allowing the client to read correspondence

2. Real-time read the file after downloading within the client, and not taken for granted in increments of 10240

Guess you like

Origin www.cnblogs.com/pythonywy/p/11123051.html