Problems with "socket" module Pico W [Resolved]
Posted: Sat Aug 06, 2022 2:01 am
I have discovered that MicroPython code that executes correctly on an ESP32/ESP-01 pair does not work at all on my PicoWs with this MicroPython build:
MicroPython v1.19.1 on 2022-08-02; Raspberry Pi Pico W with RP2040
As mentioned above, the script works in both directions on an ESP32/ESP-01 pair but not on a pair of PicoWs.
Has there been anything reported about a problem with the "socket" module or does anyone see a reason why the script shouldn't run on PicoWs?
Emily
MicroPython v1.19.1 on 2022-08-02; Raspberry Pi Pico W with RP2040
Code: Select all
# UDP Talker
import socket
UDP_IP = "10.0.1.XX" #must be the ip address:port of listener
UDP_PORT = 5500
MESSAGE = b"Hello, World!"
print("UDP target IP: %s" % UDP_IP)
print("UDP target port: %s" % UDP_PORT)
print("message: %s" % MESSAGE)
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))
Code: Select all
# UDP listener
import socket
UDP_IP = "10.0.1.XX" # Must be the ip address:port of listener
UDP_PORT = 5500
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.bind((UDP_IP, UDP_PORT))
while True:
data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
print("received message: %r" % data)
Has there been anything reported about a problem with the "socket" module or does anyone see a reason why the script shouldn't run on PicoWs?
Emily