Skip to content

Commit

Permalink
fix(mdns): bind pytest sockets interface to eth0
Browse files Browse the repository at this point in the history
  • Loading branch information
wqx6 committed Jan 17, 2024
1 parent 5000a9a commit 0e29823
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions components/mdns/examples/query_advertise/pytest_mdns.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def mdns_server(esp_host, events):
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BINDTODEVICE, 'eth0\0'.encode('utf-8'))
sock.setblocking(False)
sock.bind((UDP_IP, UDP_PORT))
mreq = struct.pack('4sl', socket.inet_aton(MCAST_GRP), socket.INADDR_ANY)
Expand Down

0 comments on commit 0e29823

Please sign in to comment.