Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions adafruit_esp32spi/adafruit_esp32spi_socketpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ def connect(self, address, conntype=None):
depending on the underlying interface"""
host, port = address
if conntype is None:
conntype = self._interface.TCP_MODE
conntype = (
self._interface.UDP_MODE
if self._type == SocketPool.SOCK_DGRAM
else self._interface.TCP_MODE
)
if not self._interface.socket_connect(
self._socknum, host, port, conn_mode=conntype
):
Expand All @@ -117,7 +121,7 @@ def connect(self, address, conntype=None):

def send(self, data):
"""Send some data to the socket."""
if self._type is SocketPool.SOCK_DGRAM:
if self._type == SocketPool.SOCK_DGRAM:
conntype = self._interface.UDP_MODE
else:
conntype = self._interface.TCP_MODE
Expand Down