UDP problems
Posted: Tue Apr 07, 2020 12:05 pm
Hello, i try to figure out how to send UDP messages from a D1 mini with Wifi.
From normal Python in the same Network -> no problem
My code:
The sendto command results in a '5' so i guess it was send.
The d1 connects to the wifi (ifconfig() giving an IP adress)
When sending UDP with my Ipad to ("192.168.101.4", 11152) the message can be received.
Any thoughts? do i have any mistake in understanding?
Thanks
From normal Python in the same Network -> no problem
My code:
Code: Select all
import network
import usocket as socket
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect('Test', 'test')
udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
addr = ("192.168.101.4", 11152)
data = "hello"
while True:
udp.sendto(data, addr)
The d1 connects to the wifi (ifconfig() giving an IP adress)
When sending UDP with my Ipad to ("192.168.101.4", 11152) the message can be received.
Any thoughts? do i have any mistake in understanding?
Thanks