Today, try to use only single processes , Single thread , Multitasking without a collaboration web Server simple programming . There are many problems , The harvest is great . First put in the core code

There is no problem in the overall thinking, but there are many small problems , I just want to record it here :
1. At the beginning of the program , The connection was successful , But no matter how you send the data , I can't get it

The check found that it was in the code , At the beginning, the design didn't pay attention to the details ,.recv() in , No parameters have been set . This will produce an exception , As a result, the data received is the same as not received — raise an exception .
solve : By printing the exception e, The results are as follows , find bug


Through this carelessness , In fact, I have learned a lot , use first time.sleep(), You can slow down the process , Better test procedures ; secondly , Learn to debug , application try……exce The convenience of the framework ; last , Of course, it reminds me to pay attention to the good development of programming habits .
2. then , That's the second problem , After the simulated client on the debug assistant is disconnected , My program is still outputting
The client has no data coming , theoretically , According to four waves , In the program , When disconnected , It should be walking to else, instead of except, because recv_data It should have been received , It's just an empty string , that , Why do exceptions occur , Think the connection is still there ? After checking the code over and over again , Consider that it may be due to the debugging assistant , Click to disconnect , Is it really disconnected ? My conjecture proved to be correct . It's the debugging assistant's little bug, You need to turn off the debugging assistant as a whole , The connection is really disconnected , Disconnect only , Close the interface of the simulated client , The connection is not really closed . last , Post the right results that are moving

Technology