Skip to content

Commit e480277

Browse files
authored
Allow optional nbytes parameter for recv_into
1 parent 52208e4 commit e480277

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

adafruit_esp32spi/adafruit_esp32spi_socket.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,14 @@ def recv(self, bufsize=0):
161161
gc.collect()
162162
return ret
163163

164-
def recv_into(self, buffer):
164+
def recv_into(self, buffer, nbytes=None):
165165
"""Read some bytes from the connected remote address into a given buffer
166166
167167
:param bytearray buffer: The buffer to read into
168168
"""
169169

170170
stamp = time.monotonic()
171-
to_read = len(buffer)
171+
to_read = len(buffer) if nbytes is None else nbytes
172172
received = []
173173
while to_read > 0:
174174
# print("Bytes to read:", to_read)

0 commit comments

Comments
 (0)