ESP32: Socket.listen(backlog) leads to OSError: 112
Currently I'm trying to listen to a socket. My setup is utilizing uasyncio.
But the same error is happening with plain use of sockets as well.
I'm building the master branch with EspIDF 3.3.1
import usocket as _socket
ai = _socket.getaddrinfo("0.0.0.0", 80, 0, _socket.SOCK_STREAM)
ai = ai[0]
s = _socket.socket(ai[0], ai[1], ai[2])
s.setblocking(False)
s.setsockopt(_socket.SOL_SOCKET, _socket.SO_REUSEADDR, 1)
s.bind(ai[-1])
s.listen(10)
Edit:
Just finished tests with ESP IDF 4 --> Same problem.
socket - OSError: [Errno 112] EADDRINUSE
running firmware esp32spiram-20210623-v1.16.bin
when I run the code below I get this error when I bind the address and port.
OSError: [Errno 112] EADDRINUSE
[code]
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(('', 67))
[/code]
if I change sock.bind(('', 67)) to sock.bind(('192.168.1.100', 67)) which is the IP address for the WiFI I get the same Error.
Nothing is using this address and I am not sure why I am getting the error. maybe someone can chime in about why this is failing.