Skip to content

Commit 40b51da

Browse files
committed
socket.connect(): Auto-select UDP_MODE
This improves compatibility with the standard socket module
1 parent 69b6e97 commit 40b51da

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: adafruit_esp32spi/adafruit_esp32spi_socketpool.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,11 @@ def connect(self, address, conntype=None):
108108
depending on the underlying interface"""
109109
host, port = address
110110
if conntype is None:
111-
conntype = self._interface.TCP_MODE
111+
conntype = (
112+
self._interface.UDP_MODE
113+
if self._type == SocketPool.SOCK_DGRAM
114+
else self._interface.TCP_MODE
115+
)
112116
if not self._interface.socket_connect(
113117
self._socknum, host, port, conn_mode=conntype
114118
):

0 commit comments

Comments
 (0)