Connectionabortederror: [Winerror 10053] an Established Connection Was Aborted by the Software in Your Host MAChine

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, your str(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



Leave a reply



Submit