There are two main ways to transfer data between Android phones and computers based on WiFi:
One is the implementation of FTP protocol, the Android phone as the data transfer process of the FTP server;
One is implemented via the HTTP protocol. The Android Phone acts as an HTTP server during the data transfer process.
Therefore, the technical implementation of the difficulty lies in how our app implementation of FTP or HTTP server functions, of course, you can read the FTP protocol or HTTP protocol, according to the specification of their own implementation of a, if you have sufficient time, technical clearance, another way is to seek the help of the open source community, This paper focuses on the analysis of several existing Internet data transfer apps to illustrate the selection of Open source FTP or HTTP server.
"Baidu Library"
The new version of the Baidu Library to achieve the WiFi wireless transmission function, the interface as shown on the left, you can see that it is implemented through the FTP protocol. In the PC-side "My Computer" address bar to enter the FTP address, you can access the file on the phone, the interface as shown in the right, you can see this is an FTP virtual directory, the structure is well organized. At the same time, because the FTP transfer function of the library is launched in a service, therefore, in the file transfer, do not need to stay in this interface, you can use the file to transfer the book while using other functions of the app.
Through analysis, Baidu Library is based on the open source FTP server Colorado FTP to achieve WiFi wireless data transmission.
Colorado FTP is a Java-implemented FTP server with the advantages of being fast, reliable and extensible, fully compatible with RFC 959 and RFC3659, but because Colorado FTP is not specifically tailored for Android devices, Therefore, if used on Android devices, it will take a certain amount of work to technical transformation. The project address is: http://cftp.coldcore.com/index.html, follows the LGPL agreement, therefore the commercial software may use confidently;
"Anyview"/"Read More"
These two apps are also FTP-based wireless books, which are put together because they all use the same technical solution, as shown in the interface. These two apps in the file transfer, can only stay in the file transmission interface, as long as the exit interface, the FTP connection is interrupted, less friendly, at the same time, in the "My Computer" address bar entered the FTP address successfully connected, the default entry is the root directory of mobile phone sdcard, there is no custom FTP virtual directory.
Through analysis, these two apps all use swiftp to realize the function of FTP server.
Swiftp is an open source FTP server specifically tailored for Android devices, and it's easy to integrate into your app. The project address is:
HTTPS://GITHUB.COM/PPAREIT/SWIFTP, in accordance with the GPL, is generally considered a "contagious" virus, because if you use an open source code that follows the protocol, your entire app's code must be open source. Visible, Anyview and read the two apps developers, did not understand how to use the swiftp, fortunately, China is currently in open source this piece is not in line with the world, small companies directly using the GPL-compliant open source code can be no concern.
"FTP Data Transfer Summary"
Based on the FTP protocol to achieve wireless transmission, the basic principle is to port an open-source FTP server to Android devices, and then integrated into their own apps. So the key is open source FTP server selection, also saw a little app using Apache ftpserver,apache ftpserver is a pure Java implementation of the FTP service, is a complete and portable FTP server engine solution, It implements the underlying network operation based on the well-known Mina framework. Project address: http://mina.apache.org/ftpserver-project/index.html, but it seems that the project needs to integrate more third-party jar packages, will make the final apk size larger, so it is not recommended.
Comprehensive consideration: 1) Follow the open source Agreement; 2) integration difficulty; 3) The expansion of the APK volume after integration; we recommend using Colorado FTP.
"Jinshan Shared Genie"
It seems that the app has not been updated for a long time, it is estimated that the project was stopped, but its implementation of the scheme can also be referenced, based on the implementation of the HTTP protocol wireless transmission, in the PC-side browser input HTTP address, the interface as shown. This web interface should be a special FE engineer to achieve, here can be very convenient to operate the opponent's SD card, the UI is still very good.
Through analysis, the Golden Hill Sharing wizard uses jetty as the HTTP server and Servlet container, but uses jetty's Codehaus branch. The JETTY of the Codehaus branch can be found at the following address: Http://docs.codehaus.org/display/JETTY/Downloading+Jetty.
Jetty follows two open source protocols: Apache Licence 2.0 and Eclipse Public License 1.0. Commercial software is free to use.
"Virtual Data Cable"
This app also implements the FTP and HTTP two ways of wireless data transmission, its FTP method based on SWIFTP implementation, here only the implementation of the HTTP method. After entering the HTTP address in the PC-side browser, the interface looks like this:
The virtual data cable also uses jetty as the HTTP server, but the jetty Eclipse branch is used, and the project address is:
http://www.eclipse.org/jetty/.
"HTTP Data Transfer Summary"
The basic principle of wireless data transmission based on HTTP protocol is to migrate an open source HTTP server to an Android device, start the HTTP server before transmitting data, and implement its own web interface and functions as needed, which may require the intervention of FE Engineers. If you do need to use HTTP, consider using jetty.
Research on the technology of mobile data transmission between PC and handset based on WiFi in Android