During operation of the user to the client side as the main human-computer interaction , which contains a list of files to view the server into a folder , download, send and delete files or folders and other operations. Server is passively respond to the client's request operation , but without requiring the user to manually operate , it will automatically cycle resolution requests the client's instructions , then revert appropriate return instructions and data. Instruction is converted by a 4-byte integer array , all instructions corresponding numeric code is unique. Client requests and server responses instruction
The format used is so different . The client sends a full request data format: command + data length + data content , the length of which is an integer number is converted into an array of 4-byte array that indicates the length of the back of the data content , the latter may file the data content name or file information data . Full data recovery service side format: Reply command + data content , which is an array of 16 -byte instruction reply , its format is : Command + error message + terminator + data length , these four parts are 4 bytes array
Error message indicates that the server process in response to the type of error ( no error reply 0 ) ; terminator indicates that the current information is the first of several conditions, the current file path returns an end return 0 ; data length indicates the length of the back of the data content , it may be file name or text message data . Design and Development of An Android-based File Transfer Tool(5):http://www.youerw.com/jisuanji/lunwen_18091.html