table of Contents
first step
Http return data to the browser, divided into header and body parts.
The second step
Return html file to the browser
simply write an html file
problems: when writing server-side program, will response_headers = "HTTP / 1.1 200 OK \ r \ n \ r \ n" written response_headers = "HTTP / 1.1 200 OK \ r \ n "to open the browser found a blank page, right after the modification, the normal web page.
third step
Adding multi-process
First to introduce multi-process:
problems encountered: part IDLE does not support multiprocessing module, does not call the child process.
Solution: performing multi-process .py python in cmd instructions directly to
our code introduced multiprocessing module using new_process = multiprocessing.Process (target = subprocess, args = (parameter 1)) (note is args tuple)
new_process.start () instruction
there is still a small problem, open the web site, found a blank.
Adding Multithreading
In our code, introducing threading module using new_thread = threading.Thread (target = subprocess, args = (parameter 1)) (note tuple args)
new_thread.start () instruction