[ESP8266] How to get client address when using readinto?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
MrJake222
Posts: 4
Joined: Sun Sep 12, 2021 12:05 pm

[ESP8266] How to get client address when using readinto?

Post by MrJake222 » Tue Sep 14, 2021 2:30 pm

Hello,

I'm confused. My code:

Code: Select all

# bad, no sender data
cnt = s.readinto(self._buffer, BUFSIZE)
print(cnt, self._buffer)

# bad, allocates new buffer
buf, peer = s.recvfrom(BUFSIZE)
print(buf, peer)
How to achieve recvfrom_into functionality from CPython? I don't want to allocate new buffers constantly and have an address to reply to. How?

Post Reply