Closed anecdata closed 3 years ago
@brentru Do you see any issues with adding the kwarg to socket.send()
?
I do have an issue with this PR - the socket
class should match CPython Socket send (https://docs.python.org/3.8/library/socket.html#socket.socket.send) and SocketPool's socket send
(https://circuitpython.readthedocs.io/en/latest/shared-bindings/socketpool/index.html#socketpool.Socket.send).
Instead, like CPython, within the init
's type
kwarg, could you pass SOCK_DGRAM
from the code initializing the socket, instead of SOCK_STREAM
to make the socket a UDP type? The conntype
kwarg wouldn't be added to send
since you could add a new private type
attribute to the socket.
I can look in to that. I mirrored the way connect
uses the kwarg (even though there is no "connect" with UDP, the call is needed - NINA, and the Arduino WiFi structures it's written around are very un-CPython-like.).
Re-tested with (modified) UDP client. Regression tested with TCP client and HTTP client (Requests).
UDP Client was previously possible using
esp
calls directly. This change allows UDP Client at thesocket
level.