The reason for this project is when you want to share files from your phone to pc/laptop or vice versa. What You do???
- By Using the cable??
- By some sharing apps??
- By gmail?? For one to one these methods works well. But for one to many what you gonna do?????
Here it is..................
This was the reason for my project. In this project I created a HTTP Server for file handling, means you can upload file and delete them from anywhere only if your are connected to same network i.e., same Wifi/mobile network.
ENC = sys.stdout.encoding
ENC_MAP = {"cp936": "gbk"}
CHARSET = ENC_MAP.get(ENC, "utf-8")
reload(sys)
sys.setdefaultencoding("utf-8")
logging.basicConfig(
level=logging.INFO,
format="[%(asctime)s] [%(levelname)s] - %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
)
FILE_NAME = os.path.basename(__file__).split('.')[0]
WORK_PATH = sys.argv[2] if sys.argv[2:] else os.getcwd()
Next File Handling, means accessing the files from your local system. Here you can edit which directory You want (Default: Current Directory).
Http Request Handling, here the protocol communication ocuurs requesting and processing the response.
Here I am creating a socket for connection and then using multithreading concepts.
whenever a new connection is made it creates one thread and run it.
So you can make simultaneous connections.
> python http_server.py [port]
or
> python http_server.py
this takes a default port 8000
-- For pc/laptop open web browser and type localhost:[port](default:8000)
-- For mobile open browser and type the systems ip adress:port number [example: 198.19.12.34:8000]
- All the details will be stored in a json file. It is automatically created by code itself.
PC ScreenShot
Mobile Screenshot