← index #5624Issue #7505
Related · high · value 1.361
QUERY · ISSUE

ESP32: Socket.listen(backlog) leads to OSError: 112

openby mrwhy-origopened 2020-02-08updated 2020-02-11
port-esp32

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.

CANDIDATE · ISSUE

socket - OSError: [Errno 112] EADDRINUSE

closedby kdschlosseropened 2021-07-07updated 2025-03-03

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.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied