Skip to content

Commit fc0f07c

Browse files
authored
Merge pull request adafruit#34 from justmobilize/use-sedto
Use sendto
2 parents 5cea507 + 4a5775a commit fc0f07c

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

adafruit_ntp.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,8 @@ def datetime(self) -> time.struct_time:
8585
for i in range(1, PACKET_SIZE):
8686
self._packet[i] = 0
8787
with self._pool.socket(self._pool.AF_INET, self._pool.SOCK_DGRAM) as sock:
88-
# Since the ESP32SPI doesn't support sendto, we are using
89-
# connect + send to standardize code
9088
sock.settimeout(self._socket_timeout)
91-
sock.connect(self._socket_address)
92-
sock.send(self._packet)
89+
sock.sendto(self._packet, self._socket_address)
9390
sock.recv_into(self._packet)
9491
# Get the time in the context to minimize the difference between it and receiving
9592
# the packet.

0 commit comments

Comments
 (0)