Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.
This repository was archived by the owner on Sep 6, 2023. It is now read-only.

EINVAL on s.close() #193

@manningt

Description

@manningt

ntptime.time() works fine on ESP8266 and OSX platforms.

I can't get it to work on an ESP32, as per the following trace:

>>> wlan.ifconfig()
('10.0.1.53', '255.255.255.0', '10.0.1.1', '10.0.1.1')
>>> import usocket as socket
␛[0;32mI (75948) modsocket: Initializing␛[0m
>>> NTP_QUERY = bytearray(48)
>>> NTP_QUERY[0] = 0x1b
>>> addr = socket.getaddrinfo("pool.ntp.org", 123)[0][-1]
>>> s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
>>> s.settimeout(1)
>>> s.sendto(NTP_QUERY, addr)
48
>>> msg = s.recv(48)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 110] ETIMEDOUT

The ESP32 module I'm using can communicate to other servers using urequests, so I don't think its a networking problem.

I do not have a sniffer to determine if the socket.sendto is sending the NTP_QUERY correctly.
Adding socket.SO_REUSEADDR did not change things.

Does anyone else have ntptime.time working on an ESP32? Any suggestions on debugging?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions