← index #4425Issue #8688
Related · high · value 3.527
QUERY · ISSUE

esp8266 recvfrom() gives ap address instead of source

openby pmp-popened 2019-01-24updated 2019-05-13
port-esp8266

on esp8266 with master :
STA 192.168.4.2 send packet to AP with sendto( data, ('192.168.4.1',port) )

on ap data, adrr = recvfrom() gives addr[0] == '192.168.4.1' source address instead of '192.168.4.2'

CANDIDATE · ISSUE

ESP8266 v1.18 Unreliable UDP Receiving From Broadcast Address (ex 192.168.1.255)

closedby PsuFanopened 2022-05-21updated 2024-09-08
bugneeds-info

Anyone else having issues receiving UDP packets? I can send 10-20 packets and only receive one packet. I send them with another esp or with my computer and can see the packets in Wireshark but hardly any are received with the 8266. It seems to be substantially worse when I send to the broadcast (ex 192.168.1.255) vs directly to the esp IP address. Should I be using a multicast address instead? Not sure what the differences are.

socket = socket(AF_INET, SOCK_DGRAM)
socket.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
socket.bind(('', 1011))
socket.setblocking(False)

while True:
	try:
		data, addr = self.socket.recvfrom(1024)
		print('Recv Data From %s' % str(addr))
	except OSError as err:
		if err.args[0] != 11:
			print(err)

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