Phones are essentially miniaturized computers. If you connect your phone to a monitor, keyboard and mouse, it essentially becomes a computer. In this article, let us discuss about how to use an Android phone or a computer as a server and transfer the data into another phone or computer.
Doing this procedure on an Android device, you just need to install the app named Termux, which provides you with a Linux Terminal on Android.
If you don't have python installed already, install it using
apt-get or
apt using the respective commands listed below on your Linux Terminal or Termux. Note that admin privileges may be required to do so.
apt install python
apt-get install python
After you are done installing, before you create the server, you need to know what your IP address is so that other devices can access it. To obtain the IP address, simply type in the following command:
ifconfig
In this case, the highlighted portion in the image above is the IP Address,
192.168.43.182. Now let us create the server and access it. The following command helps with the same:
python -m SimpleHTTPServer
or
python -m http.server
The server would be available at
http://192.168.43.182:8000. You can open that using your browser on your phone or computer connected to the same network as the server. If you wish to share a different directory, use
cd command to move into a different folder and use the command above to host the server. If you want to share everything on your phone, perhaps running
cd ../../../ and then running the command above would help.
Interesting use case:
Once upon a time, I did not have any application installed on my phone that could be used for sharing files. I had a file which I needed to transfer with a few of my friends. So, I went ahead with setting up a hotspot and asked everyone to connect to the hotspot. This ensured that we were in the same network. After that I went ahead to create a server using the method suggested above. And everyone could download the file that I wanted to share.
Comments
Post a Comment