Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Udp broadcast support #9

Open
lorismich opened this issue Mar 31, 2022 · 1 comment
Open

Udp broadcast support #9

lorismich opened this issue Mar 31, 2022 · 1 comment

Comments

@lorismich
Copy link

The module turns on and I am able to receive an address via DHCP but when I try to initialize a UDP socket to transmit a broadcast package I received an error:

[code]>> import socket

socket.SOL_SOCKET
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'module' object has no attribute 'SOL_SOCKET'[/code]

Why SOL_SOCKET isn't defined ? I also tried with usocket module with the same result:

[code]>>> import usocket

usocket.SOL_SOCKET
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'module' object has no attribute 'SOL_SOCKET'[/code]

@simryang
Copy link

For my cases, it works. Which version do you use?
I used W5100S_EVB_PICO-20230426-v1.20.0.uf2 file from https://micropython.org/download/W5100S_EVB_PICO/

>>> import usocket
>>> print(usocket, type(usocket))
<module 'lwip'> <class 'module'>
>>> print(dir(usocket))
['__class__', '__name__', '__dict__', 'AF_INET', 'AF_INET6', 'IPPROTO_IP', 'IP_ADD_MEMBERSHIP', 'IP_DROP_MEMBERSHIP', 'SOCK_DGRAM', 'SOCK_RAW', 'SOCK_STREAM', 'SOL_SOCKET', 'SO_REUSEADDR', 'callback', 'getaddrinfo', 'print_pcbs', 'reset', 'socket']
>>> print(usocket.SOL_SOCKET)
1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants