Requirement: Android Classic Bluetooth send file, send side support pause operation (Pervert!!!!!) ), also want to continue the breakpoint (more abnormal!!!) )
Approximate implementation:
Client sends a fixed length package, the first packet header (fixed length) contains this file identifier (name, total file flow length, etc.), and to handle the socket buffer
Overflow problem to prevent drops from appearing.
Server side read data from the socket in accordance with the fixed-length packet read, length is not enough, such as the next group of data, the length of the truncated, each data stream Baotou judgment, the previous file is not received, the case, received the packet header data stream, discarded, began to accept the new file stream.
Case point: The process of judging Baotou: There are two ways:
1. Fixed length package, each package contains a fixed length Baotou (flow waste)
2. Only the first Baotou, the header contains the file MD5 value (the file stream contains its MD5, there is only theoretically possible)
Handling problems with receiving packages when you send files to Android classic Bluetooth