TCP/IP protocol provides two kinds of computer communication modes: TCP mode and UDP mode.
As a link-oriented service, TCP builds links before transferring files by which it provides data flow, flow control, error detection and correction services in two-way, orderly and non-duplicate mode, so as to ensure the correctness of file transfer. On the contrary, UDP is a connectionless service. It can not ensure the correct file receipt end. Therefore, using UDP requires users to do receiving confirmation work themselves.
2.2 Research Scheme and the Extensible Functions
1. Application environment: Android mobile phone operating system, version 2.2 and above
2. Hardware environment: 40GB hard disk space, 4GB RAM, and 64/32 bit CPU
3. Development environment: Windows operating system, Eclipse3.3, JDK6.0, SDK and ADT plug-in
4. Programming language: Java
5. Database: Android built-in SQLite
2.3 Research Method
This file transfer tool is developed based on win socket broadcast transmission mode to realize file and folder transfer. Therefore, this study first analyzes existing functions and new demands of file transfer system. Second, this study adopts related development tools to further develop this system. In development process, difficulties and confusions have been solved by consulting supervisor, internet, and laboratory. Third, based on demand analysis, system development plan and implementation process have been designed. Finally, the designed file transfer tool is run and debugged with operational logs recorded.
Research objectives: This paper aims to design and develop an Android platform based file transfer tool to support upload and download of multi-protocol files. Using this tool, users can transfer files by verifying and logining servers.
Features:
1. Users can log on different servers, including anonymous login to the FTP server;
2. Support multithreading download and batch upload and download;
3 Support interactive transmission between mobile phones and PC terminals;
4. Convenient for users to manage and store downloaded files;
5. Friendly interface and convenient operation.
2.4 Based on Socket network communication
Implementation process Socket Communications Socket Figure 3 connection-oriented network communication is the use of client / server (Client / Server) operating mode [ 6 ] , the use of Socket network communication interfaces to achieve communication between client and server . Socket interface is a TCP / IP network API, which in the OSI ( Open Systems Interconnection Reference Model ) is mainly concentrated in the transport and session layers . Socket is often called a " socket " , used to describe the IP address and port , is a communication communications connection handle , the application is a request or a response to the network via Socket network requests . Socket according to the protocol used for the connection and can be pided into two kinds of methods of operation for non- connection , using TCP / IP protocol Socket method of operation is connection-oriented, reliable communication ; using UDP Socket operation of non-connection -oriented approach is unreliable communications. Due to the connection -oriented and reliable means of communication to ensure better client and server data synchronization and consistency , so the system uses a connection -oriented approach . Android provides a Socket and ServerSocket 2 classes , and implements all two-way Socket client and server connections .
2.5 Communication protocol designed
Socket communication network in the process , the initial state of the server is blocked waiting for the establishment of a data stream to the receiving client , the return flow after the data have been received since the client model such communication must be initiated by a client request to the first data , and data exchange between the server and the formation of the form of round-trip loop . This interaction must be established under a complete set of communication protocols for data transmission in order to ensure the soundness and efficiency. Java language Socket data stream is encapsulated into the output stream (OutputStream) and the input stream (InputStream), the basic unit of transmission is a byte , therefore, the data communication protocol definitions and transmission format are arranged into an array of bytes . For string type (String), because it contains Chinese characters in the file name transfer , you must use the 16 -length encoding format , the author uses the UTF-16LE encoding format , this format string characters occupy 2 bytes, in the Java language by String. getBytes ("utf-16le") method to convert a string of characters into a corresponding sequence of bytes , which returns a string corresponding byte array ; through new String (byteArray, "utf-16le") method to bytes byte array into a corresponding sequence of characters , thereby returning a complete string. For integer data types (Integer), accounting for 4 -byte length in the Java language , the conversion phase shifted by four methods into a 4 byte array ; Similarly, for an integer data into the 4 byte array , can also be converted to an integer data through four phase shift method . For the data type of the file , in Android can be constructed by methods FileInputStream and FileOutputStream file input stream and file output stream , this data stream is also in bytes , so the network can communicate directly with the data stream Socket butt , without conversion or packaging.
- 上一篇:C#房屋信息管理系统的设计与实现
- 下一篇:ASP.net在线招聘系统的设计与开发
-
-
-
-
-
-
-
java+mysql车辆管理系统的设计+源代码
电站锅炉暖风器设计任务书
杂拟谷盗体内共生菌沃尔...
乳业同业并购式全产业链...
河岸冲刷和泥沙淤积的监测国内外研究现状
中考体育项目与体育教学合理结合的研究
当代大学生慈善意识研究+文献综述
酸性水汽提装置总汽提塔设计+CAD图纸
十二层带中心支撑钢结构...
大众媒体对公共政策制定的影响