Django: [WinError 10053] An established connection was aborted by the software in your host machine
The issue was with the timeout on a client-side. By default some browsers set very small timeout number (1s in my case). And when server couldn't process the request aborted the connection.
I've fixed it by setting the timeout to 5s
.
Python Error ConnectionAbortedError: [WinError 10053]
The if statement if not data
is equivalent to writing if data != ""
, while the empty string your server receives is b''
. You have several options to fix it.
data = conn.recv(1024).decode()
is the proper way to allocate the data sent by the client. You can now print(data)
or compare data
to an empty string.
If you still don't want to decode()
your message you could change your if statement to if data != b''
or if data is not None
.
Update
If it wasn't clear, yourstr(data)
conversion causes the if statement to work unproperly, which is set to False
without allowing you to break when a client disconnects.
Related Topics
Should All Python Classes Extend Object
How to Flatten a Pandas Dataframe with Some Columns as JSON
Safely Create a File If and Only If It Does Not Exist with Python
Running Multiple Bash Commands with Subprocess
How to Concatenate Element-Wise Two Lists in Python
Basic Program to Convert Integer to Roman Numerals
How to Detect If a File Is Binary (Non-Text) in Python
Continuing in Python's Unittest When an Assertion Fails
Os.Path.Dirname(_File_) Returns Empty
How to Include Image Files in Django Templates
Logisticregression: Unknown Label Type: 'Continuous' Using Sklearn in Python
How to Convert a Python List into a C Array by Using Ctypes
Importerror: Cannot Import Name Numpy_Mkl
Failed Loading English.Pickle with Nltk.Data.Load
Define CSS Class in Django Forms
Python Spacing and Aligning Strings
SQL Alchemy Orm Returning a Single Column, How to Avoid Common Post Processing