UDP.sendto problem

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
sdfgeoff
Posts: 2
Joined: Wed Jun 15, 2016 9:27 pm

UDP.sendto problem

Post by sdfgeoff » Wed Jun 15, 2016 9:37 pm

Howdy. I've been using the ESP8266 with the kickstarters v4 firmware and have hit a problem with sending UDP data.

I'm trying to imiatate a DNS server such that I can redirect all web traffic to a webpage served by the ESP8266. The code to do with sending the DNS looks like:
[code]
dns_addr = ('', 53)
dns_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) #UDP
dns_socket.bind(dns_addr)
dns_socket.setblocking(0)

def serve_dns():
try:
data, addr = dns_socket.recvfrom(1024)
except OSError:
return

packet = b'\x00\x01\x00\x01\x00\x00\x00\x3c\x00\x04' # And a whole lot more to be a proper DNS response

dns_socket.sendto(packet, addr)
[/code]

Upon reaching the dns_socket.sendto(), I get the error:

[code]
OSError: -1071215956
[/code]

The [url=http://docs.micropython.org/en/latest/e ... ket.sendto]documentation[/url] states that the sendto method is not implemented, but other sources [url=viewtopic.php?t=1819]suggest[url] it is.


And it appears because I'm a new user, that BBCode is off. Darn.

sdfgeoff
Posts: 2
Joined: Wed Jun 15, 2016 9:27 pm

Re: UDP.sendto problem

Post by sdfgeoff » Wed Jun 15, 2016 10:20 pm

I flashed the ESP with the nightly build:
http://www.kaltpost.de/~wendlers/micropython/

And it worked. So it seems to have been added/fixed in a later revision.

Post Reply