Showing content from https://docs.circuitpython.org/en/latest/shared-bindings/socketpool/index.html below:
Website Navigation
socketpool — Adafruit CircuitPython 1 documentation
socketpool
The socketpool
module provides sockets through a pool. The pools themselves act like CPython’s socket
module.
For more information about the socket
module, see the CPython documentation: https://docs.python.org/3/library/socket.html
AF_INET6 (IPv6) supported on these boards
- 01Space 0.42 OLED ESP32C3
- AITHinker ESP32-C3S_Kit
- AITHinker ESP32-C3S_Kit_2M
- ATMegaZero ESP32-S2
- Adafruit Camera
- Adafruit Feather ESP32 V2
- Adafruit Feather ESP32-C6 4MB Flash No PSRAM
- Adafruit Feather ESP32-S2 Reverse TFT
- Adafruit Feather ESP32-S2 TFT
- Adafruit Feather ESP32-S3 Reverse TFT
- Adafruit Feather ESP32-S3 TFT
- Adafruit Feather ESP32S2
- Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM
- Adafruit Feather ESP32S3 No PSRAM
- Adafruit Feather HUZZAH32
- Adafruit FunHouse
- Adafruit HUZZAH32 Breakout
- Adafruit ItsyBitsy ESP32
- Adafruit MagTag
- Adafruit MatrixPortal S3
- Adafruit Metro ESP32S2
- Adafruit Metro ESP32S3
- Adafruit Mini Sparkle Motion
- Adafruit QT Py ESP32 PICO
- Adafruit QT Py ESP32-S3 4MB Flash 2MB PSRAM
- Adafruit QT Py ESP32-S3 no psram
- Adafruit QT Py ESP32C3
- Adafruit QT Py ESP32S2
- Adafruit Sparkle Motion
- Adafruit Sparkle Motion Stick
- Adafruit Vindie S2
- Adafruit-Qualia-S3-RGB666
- Ai Thinker ESP32-CAM
- Arduino Nano ESP32
- Artisense Reference Design RD00
- AutosportLabs-ESP32-CAN-X2
- BARDUINO 4.0.2
- BLING!
- BPI-Bit-S2
- BPI-Leaf-S3
- BPI-PicoW-S3
- BastWiFi
- Bee-Data-Logger
- Bee-Motion-S3
- Bee-S3
- BlizzardS3
- CRCibernetica IdeaBoard
- CircuitART Zero S3
- ColumbiaDSL-Sensor-Board-V1
- CrowPanel 4.2 EPaper
- CrumpS2
- Cytron Maker Feather AIoT S3
- DFRobot Beetle ESP32-C3
- DFRobot FireBeetle 2 ESP32-S3
- Deneyap Kart
- Deneyap Kart 1A
- Deneyap Kart 1A v2
- Deneyap Kart G
- Deneyap Mini
- Deneyap Mini v2
- EDGES3D
- ES3ink
- ESP 12k NodeMCU
- ESP32 Devkit V1
- ESP32-C3-DevKitM-1
- ESP32-C6-DevKitC-1-N8
- ESP32-C6-DevKitM-1
- ESP32-H2-DevKitM-1
- ESP32-P4 Stamp XL
- ESP32-P4-Function-EV
- ESP32-S2-DevKitC-1-N4
- ESP32-S2-DevKitC-1-N4R2
- ESP32-S2-DevKitC-1-N8R2
- ESP32-S3-Box-2.5
- ESP32-S3-Box-Lite
- ESP32-S3-DevKitC-1-N16
- ESP32-S3-DevKitC-1-N32R8
- ESP32-S3-DevKitC-1-N8
- ESP32-S3-DevKitC-1-N8R2
- ESP32-S3-DevKitC-1-N8R2 (ROS version)
- ESP32-S3-DevKitC-1-N8R8
- ESP32-S3-DevKitC-1-N8R8-with-HACKTABLET
- ESP32-S3-DevKitM-1-N8
- ESP32-S3-EYE
- ESP32-S3-USB-OTG-N8
- ESP8684-DevKitC-02-N4
- Elecrow CrowPanel
- Espressif ESP32 DevKitc V4 WROOM-32E
- Espressif ESP32 DevKitc V4 WROVER
- Espressif ESP32 TTGO T8 v1.7
- Espressif ESP32-EYE
- Espressif ESP32-LyraT
- Espressif-ESP32-S3-LCD-EV-Board
- Espressif-ESP32-S3-LCD-EV-Board_v1.5
- FeatherS2
- FeatherS2 Neo
- FeatherS2 PreRelease
- FeatherS3
- FeatherS3 Neo
- Flipper Zero Wi-Fi Dev
- Franzininho WIFI w/Wroom
- Franzininho WIFI w/Wrover
- Freenove ESP32-WROVER-DEV-CAM
- Gravitech Cucumber M
- Gravitech Cucumber MS
- Gravitech Cucumber R
- Gravitech Cucumber RS
- HMI-DevKit-1.1
- Hardkernel Odroid Go
- Heltec ESP32-S3-WIFI-LoRa-V3
- Heltec Vison Master E290
- Heltec Wireless Paper
- HexKyS2
- IoTs2
- Kaluga 1
- LILYGO T-DISPLAY S3 v1.2
- LILYGO T-Deck (Plus)
- LILYGO T-Display S3 Pro
- LILYGO T-Dongle S3
- LILYGO T-QT PRO NO PSRAM
- LILYGO T-QT PRO PSRAM
- LILYGO T-Watch-S3
- LILYGO TEMBED ESP32S3
- LILYGO TTGO T-01C3
- LILYGO TTGO T-DISPLAY v1.1
- LILYGO TTGO T-DISPLAY v1.1 4M
- LILYGO TTGO T-OI PLUS
- LILYGO TTGO T8 ESP32-S2
- LILYGO TTGO T8 ESP32-S2 w/Display
- LOLIN S3 16MB Flash 8MB PSRAM
- LOLIN S3 MINI 4MB Flash 2MB PSRAM
- LOLIN S3 MINI PRO 4MB Flash 2MB PSRAM
- LOLIN S3 PRO 16MB Flash 8MB PSRAM
- Lilygo T-watch 2020 V3
- Luatos Core-ESP32C3
- M5STACK STAMP-C3
- M5Stack Atom Echo
- M5Stack Atom Lite
- M5Stack Atom Matrix
- M5Stack Atom U
- M5Stack AtomS3
- M5Stack AtomS3 Lite
- M5Stack AtomS3U
- M5Stack Cardputer
- M5Stack Cardputer (ROS version)
- M5Stack Core Basic
- M5Stack Core Fire
- M5Stack Core2
- M5Stack CoreS3
- M5Stack Dial
- M5Stack M5Paper
- M5Stack Stamp-S3
- M5Stack Stick C
- M5Stack Stick C Plus
- M5Stack Stick C Plus2
- M5Stack Timer Camera X
- MORPHEANS MorphESP-240
- MagiClick S3 N4R2
- Maker Go ESP32C3 Supermini
- Maker Go ESP32C6 Supermini
- Maker badge by Czech maker
- MakerFabs-ESP32-S3-Parallel-TFT-With-Touch-7inch
- MicroDev microC3
- MicroDev microS2
- MixGo CE
- NanoS3
- Neuron
- NodeMcu-ESP32-C2
- OMGS3
- Oak Dev Tech PixelWing ESP32S2
- Oxocard Artwork
- Oxocard Connect
- Oxocard Galaxy
- Oxocard Science
- ProS3
- RGBTouch Mini
- Red S2-WROOM
- S2Mini
- S2Pico
- SQFMI Watchy
- Saola 1 w/Wroom
- Saola 1 w/Wrover
- Seeed Studio XIAO ESP32C3
- Seeed Xiao ESP32-C6 4MB Flash 512KB SRAM
- Seeed Xiao ESP32-S3 Sense
- Spotpear ESP32C3 LCD 1.44
- Spotpear ESP32C3 LCD 1.69
- Sunton ESP32-2424S012
- Sunton-ESP32-8048S050
- Sunton-ESP32-8048S070
- TTGO T8 ESP32-S2-WROOM
- Targett Module Clip w/Wroom
- Targett Module Clip w/Wrover
- ThingPulse Pendrive S3
- TinyC6
- TinyPICO
- TinyPICO Nano
- TinyS2
- TinyS3
- TinyWATCH S3
- VCC-GND YD-ESP32-S3 (N16R8)
- VCC-GND YD-ESP32-S3 (N8R8)
- VIDI X V1.1
- Waveshare ESP32-C6 LCD 1.47
- Waveshare ESP32-S2-Pico
- Waveshare ESP32-S2-Pico-LCD
- Waveshare ESP32-S3 LCD 1.47
- Waveshare ESP32-S3-ETH
- Waveshare ESP32-S3-GEEK
- Waveshare ESP32-S3-Matrix
- Waveshare ESP32-S3-Pico
- Waveshare ESP32-S3-Zero
- Waveshare ESP32S3 LCD 1.28
- Waveshare ESP32S3 Touch LCD 2
- WeAct ESP32-C6 (4MB)
- WeAct ESP32-C6 (8MB)
- WeMos LOLIN32 Lite
- Wemos Lolin C3 Mini
- Wemos Lolin C3 Pico
- cezerio dev ESP32C6
- nanoESP32-S2 w/Wrover
- nanoESP32-S2 w/Wroom
- senseBox MCU-S2 ESP32S2
- senseBox-eye ESP32S3
- sunton_esp32_2432S024C
- sunton_esp32_2432S028
- sunton_esp32_2432S032C
Available on these boards
- 01Space 0.42 OLED ESP32C3
- AITHinker ESP32-C3S_Kit
- AITHinker ESP32-C3S_Kit_2M
- ATMegaZero ESP32-S2
- Adafruit Camera
- Adafruit Feather ESP32 V2
- Adafruit Feather ESP32-C6 4MB Flash No PSRAM
- Adafruit Feather ESP32-S2 Reverse TFT
- Adafruit Feather ESP32-S2 TFT
- Adafruit Feather ESP32-S3 Reverse TFT
- Adafruit Feather ESP32-S3 TFT
- Adafruit Feather ESP32S2
- Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM
- Adafruit Feather ESP32S3 No PSRAM
- Adafruit Feather HUZZAH32
- Adafruit FunHouse
- Adafruit HUZZAH32 Breakout
- Adafruit ItsyBitsy ESP32
- Adafruit MagTag
- Adafruit MatrixPortal S3
- Adafruit Metro ESP32S2
- Adafruit Metro ESP32S3
- Adafruit Mini Sparkle Motion
- Adafruit QT Py ESP32 PICO
- Adafruit QT Py ESP32-S3 4MB Flash 2MB PSRAM
- Adafruit QT Py ESP32-S3 no psram
- Adafruit QT Py ESP32C3
- Adafruit QT Py ESP32S2
- Adafruit Sparkle Motion
- Adafruit Sparkle Motion Stick
- Adafruit Vindie S2
- Adafruit-Qualia-S3-RGB666
- Ai Thinker ESP32-CAM
- Arduino Nano ESP32
- Artisense Reference Design RD00
- AutosportLabs-ESP32-CAN-X2
- BARDUINO 4.0.2
- BLING!
- BPI-Bit-S2
- BPI-Leaf-S3
- BPI-PicoW-S3
- BastWiFi
- Bee-Data-Logger
- Bee-Motion-S3
- Bee-S3
- BlizzardS3
- CRCibernetica IdeaBoard
- CircuitART Zero S3
- ColumbiaDSL-Sensor-Board-V1
- CrowPanel 4.2 EPaper
- CrumpS2
- Cytron EDU PICO W
- Cytron Maker Feather AIoT S3
- DFRobot Beetle ESP32-C3
- DFRobot FireBeetle 2 ESP32-S3
- Deneyap Kart
- Deneyap Kart 1A
- Deneyap Kart 1A v2
- Deneyap Kart G
- Deneyap Mini
- Deneyap Mini v2
- EDGES3D
- ES3ink
- ESP 12k NodeMCU
- ESP32 Devkit V1
- ESP32-C3-DevKitM-1
- ESP32-C6-DevKitC-1-N8
- ESP32-C6-DevKitM-1
- ESP32-S2-DevKitC-1-N4
- ESP32-S2-DevKitC-1-N4R2
- ESP32-S2-DevKitC-1-N8R2
- ESP32-S3-Box-2.5
- ESP32-S3-Box-Lite
- ESP32-S3-DevKitC-1-N16
- ESP32-S3-DevKitC-1-N32R8
- ESP32-S3-DevKitC-1-N8
- ESP32-S3-DevKitC-1-N8R2
- ESP32-S3-DevKitC-1-N8R2 (ROS version)
- ESP32-S3-DevKitC-1-N8R8
- ESP32-S3-DevKitC-1-N8R8-with-HACKTABLET
- ESP32-S3-DevKitM-1-N8
- ESP32-S3-EYE
- ESP32-S3-USB-OTG-N8
- ESP8684-DevKitC-02-N4
- Elecrow CrowPanel
- Espressif ESP32 DevKitc V4 WROOM-32E
- Espressif ESP32 DevKitc V4 WROVER
- Espressif ESP32 TTGO T8 v1.7
- Espressif ESP32-EYE
- Espressif ESP32-LyraT
- Espressif-ESP32-S3-LCD-EV-Board
- Espressif-ESP32-S3-LCD-EV-Board_v1.5
- FeatherS2
- FeatherS2 Neo
- FeatherS2 PreRelease
- FeatherS3
- FeatherS3 Neo
- Flipper Zero Wi-Fi Dev
- Franzininho WIFI w/Wroom
- Franzininho WIFI w/Wrover
- Freenove ESP32-WROVER-DEV-CAM
- Gravitech Cucumber M
- Gravitech Cucumber MS
- Gravitech Cucumber R
- Gravitech Cucumber RS
- HMI-DevKit-1.1
- Hardkernel Odroid Go
- Heltec ESP32-S3-WIFI-LoRa-V3
- Heltec Vison Master E290
- Heltec Wireless Paper
- HexKyS2
- IoTs2
- Kaluga 1
- LILYGO T-DISPLAY S3 v1.2
- LILYGO T-Deck (Plus)
- LILYGO T-Display S3 Pro
- LILYGO T-Dongle S3
- LILYGO T-QT PRO NO PSRAM
- LILYGO T-QT PRO PSRAM
- LILYGO T-Watch-S3
- LILYGO TEMBED ESP32S3
- LILYGO TTGO T-01C3
- LILYGO TTGO T-DISPLAY v1.1
- LILYGO TTGO T-DISPLAY v1.1 4M
- LILYGO TTGO T-OI PLUS
- LILYGO TTGO T8 ESP32-S2
- LILYGO TTGO T8 ESP32-S2 w/Display
- LOLIN S3 16MB Flash 8MB PSRAM
- LOLIN S3 MINI 4MB Flash 2MB PSRAM
- LOLIN S3 MINI PRO 4MB Flash 2MB PSRAM
- LOLIN S3 PRO 16MB Flash 8MB PSRAM
- Lilygo T-watch 2020 V3
- Luatos Core-ESP32C3
- M5STACK STAMP-C3
- M5Stack Atom Echo
- M5Stack Atom Lite
- M5Stack Atom Matrix
- M5Stack Atom U
- M5Stack AtomS3
- M5Stack AtomS3 Lite
- M5Stack AtomS3U
- M5Stack Cardputer
- M5Stack Cardputer (ROS version)
- M5Stack Core Basic
- M5Stack Core Fire
- M5Stack Core2
- M5Stack CoreS3
- M5Stack Dial
- M5Stack M5Paper
- M5Stack Stamp-S3
- M5Stack Stick C
- M5Stack Stick C Plus
- M5Stack Stick C Plus2
- M5Stack Timer Camera X
- MORPHEANS MorphESP-240
- MagiClick S3 N4R2
- Maker Go ESP32C3 Supermini
- Maker Go ESP32C6 Supermini
- Maker badge by Czech maker
- MakerFabs-ESP32-S3-Parallel-TFT-With-Touch-7inch
- MicroDev microC3
- MicroDev microS2
- MixGo CE
- NanoS3
- Neuron
- NodeMcu-ESP32-C2
- Nordic Semiconductor nRF7002 DK
- OMGS3
- Oak Dev Tech PixelWing ESP32S2
- Oxocard Artwork
- Oxocard Connect
- Oxocard Galaxy
- Oxocard Science
- Pajenicko PicoPad
- Pimoroni Badger 2040 W
- Pimoroni Inky Frame 5.7
- Pimoroni Inky Frame 7.3
- Pimoroni Pico DV Base W
- Pimoroni Pico Plus 2 W
- Pimoroni Plasma 2040W
- Pimoroni Plasma 2350W
- ProS3
- RGBTouch Mini
- Raspberry Pi Pico 2 W
- Raspberry Pi Pico W
- Red S2-WROOM
- S2Mini
- S2Pico
- SQFMI Watchy
- Saola 1 w/Wroom
- Saola 1 w/Wrover
- Seeed Studio XIAO ESP32C3
- Seeed Xiao ESP32-C6 4MB Flash 512KB SRAM
- Seeed Xiao ESP32-S3 Sense
- SparkFun Thing Plus RP2350
- Spotpear ESP32C3 LCD 1.44
- Spotpear ESP32C3 LCD 1.69
- Sunton ESP32-2424S012
- Sunton-ESP32-8048S050
- Sunton-ESP32-8048S070
- TTGO T8 ESP32-S2-WROOM
- Targett Module Clip w/Wroom
- Targett Module Clip w/Wrover
- ThingPulse Pendrive S3
- TinyC6
- TinyPICO
- TinyPICO Nano
- TinyS2
- TinyS3
- TinyWATCH S3
- VCC-GND YD-ESP32-S3 (N16R8)
- VCC-GND YD-ESP32-S3 (N8R8)
- VIDI X V1.1
- Waveshare ESP32-C6 LCD 1.47
- Waveshare ESP32-S2-Pico
- Waveshare ESP32-S2-Pico-LCD
- Waveshare ESP32-S3 LCD 1.47
- Waveshare ESP32-S3-ETH
- Waveshare ESP32-S3-GEEK
- Waveshare ESP32-S3-Matrix
- Waveshare ESP32-S3-Pico
- Waveshare ESP32-S3-Tiny
- Waveshare ESP32-S3-Zero
- Waveshare ESP32S3 LCD 1.28
- Waveshare ESP32S3 Touch LCD 2
- WeAct ESP32-C6 (4MB)
- WeAct ESP32-C6 (8MB)
- WeMos LOLIN32 Lite
- Wemos Lolin C3 Mini
- Wemos Lolin C3 Pico
- cezerio dev ESP32C6
- nanoESP32-S2 w/Wrover
- nanoESP32-S2 w/Wroom
- senseBox MCU-S2 ESP32S2
- senseBox-eye ESP32S3
- sunton_esp32_2432S024C
- sunton_esp32_2432S028
- sunton_esp32_2432S032C
-
class socketpool.Socket
-
TCP, UDP and RAW socket. Cannot be created directly. Instead, call SocketPool.socket()
.
Provides a subset of CPython’s socket.socket
API. It only implements the versions of recv that do not allocate bytes objects.
-
__hash__() → int
-
Returns a hash for the Socket.
-
__enter__() → Socket
-
No-op used by Context Managers.
-
__exit__() → None
-
Automatically closes the Socket when exiting a context. See Lifetime and ContextManagers for more info.
-
accept() → Tuple[Socket, Tuple[str, int]]
-
Accept a connection on a listening socket of type SOCK_STREAM, creating a new socket of type SOCK_STREAM. Returns a tuple of (new_socket, remote_address)
-
bind(address: Tuple[str, int]) → None
-
Bind a socket to an address
-
Parameters:
-
address (~tuple) – tuple of (remote_address, remote_port)
-
close() → None
-
Closes this Socket and makes its resources available to its SocketPool.
-
connect(address: Tuple[str, int]) → None
-
Connect a socket to a remote address
-
Parameters:
-
address (~tuple) – tuple of (remote_address, remote_port)
-
listen(backlog: int) → None
-
Set socket to listen for incoming connections
-
Parameters:
-
backlog (~int) – length of backlog queue for waiting connections
-
recvfrom_into(buffer: circuitpython_typing.WriteableBuffer) → Tuple[int, Tuple[str, int]]
-
Reads some bytes from a remote address.
Returns a tuple containing * the number of bytes received into the given buffer * a remote_address, which is a tuple of ip address and port number
-
Parameters:
-
buffer (object) – buffer to read into
-
recv_into(buffer: circuitpython_typing.WriteableBuffer, bufsize: int) → int
-
Reads some bytes from the connected remote address, writing into the provided buffer. If bufsize <= len(buffer) is given, a maximum of bufsize bytes will be read into the buffer. If no valid value is given for bufsize, the default is the length of the given buffer.
Suits sockets of type SOCK_STREAM Returns an int of number of bytes read.
-
Parameters:
-
-
buffer (bytearray) – buffer to receive into
-
bufsize (int) – optionally, a maximum number of bytes to read.
-
send(bytes: circuitpython_typing.ReadableBuffer) → int
-
Send some bytes to the connected remote address. Suits sockets of type SOCK_STREAM
-
Parameters:
-
bytes (~bytes) – some bytes to send
-
sendall(bytes: circuitpython_typing.ReadableBuffer) → None
-
Send some bytes to the connected remote address. Suits sockets of type SOCK_STREAM
This calls send() repeatedly until all the data is sent or an error occurs. If an error occurs, it’s impossible to tell how much data has been sent.
-
Parameters:
-
bytes (~bytes) – some bytes to send
-
sendto(bytes: circuitpython_typing.ReadableBuffer, address: Tuple[str, int]) → int
-
Send some bytes to a specific address. Suits sockets of type SOCK_DGRAM
-
Parameters:
-
-
setblocking(flag: bool) → int | None
-
Set the blocking behaviour of this socket.
-
Parameters:
-
flag (~bool) – False means non-blocking, True means block indefinitely.
-
setsockopt(level: int, optname: int, value: int) → None
-
Sets socket options
-
settimeout(value: int) → None
-
Set the timeout value for this socket.
-
Parameters:
-
value (~int) – timeout in seconds. 0 means non-blocking. None means block indefinitely.
-
type: int
-
Read-only access to the socket type
-
class socketpool.SocketPool(radio: wifi.Radio)
-
A pool of socket resources available for the given radio. Only one SocketPool can be created for each radio.
SocketPool should be used in place of CPython’s socket which provides a pool of sockets provided by the underlying OS.
Create a new SocketPool object for the provided radio
-
Parameters:
-
radio (wifi.Radio) – The (connected) network hardware to associate with this SocketPool; currently, this will always be the object returned by wifi.radio
-
exception gaierror
-
Bases: OSError
Errors raised by getaddrinfo
Initialize self. See help(type(self)) for accurate signature.
-
AF_INET: int
-
AF_INET6: int
-
SOCK_STREAM: int
-
SOCK_DGRAM: int
-
SOCK_RAW: int
-
EAI_NONAME: int
-
SOL_SOCKET: int
-
SO_REUSEADDR: int
-
TCP_NODELAY: int
-
IPPROTO_IP: int
-
IPPROTO_ICMP: int
-
IPPROTO_TCP: int
-
IPPROTO_UDP: int
-
IPPROTO_IPV6: int
-
IPPROTO_RAW: int
-
IP_MULTICAST_TTL: int
-
socket(family: int = AF_INET, type: int = SOCK_STREAM, proto: int = IPPROTO_IP) → Socket
-
Create a new socket
-
Parameters:
-
-
family (~int) – AF_INET or AF_INET6
-
type (~int) – SOCK_STREAM, SOCK_DGRAM or SOCK_RAW
-
proto (~int) – IPPROTO_IP, IPPROTO_ICMP, IPPROTO_TCP, IPPROTO_UDP, IPPROTO_IPV6or IPPROTO_RAW. Only works with SOCK_RAW
The fileno
argument available in socket.socket()
in CPython is not supported.
-
getaddrinfo(host: str, port: int, family: int = 0, type: int = 0, proto: int = 0, flags: int = 0) → Tuple[int, int, int, str, Tuple[str, int]]
-
Gets the address information for a hostname and port
Returns the appropriate family, socket type, socket protocol and address information to call socket.socket() and socket.connect() with, as a tuple.
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4