Here are some terms you'll see in this documentation referring to how networking is used in Python and CircuitPython.
TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are both internet protocol suite methods for sending information across the internet.
The main difference between the two is that TCP is connection-based, while UDP is connectionless. This means that TCP requires the two ends of the communication link to remain connected throughout communication, while UDP does not.
A socket (network socket) is established within your CircuitPython program to serve as an endpoint for sending and receiving data from/to your local network or the Internet.
A socket's address is defined by its protocol, IP address and port number. The protocol is usually TCP, which is a reliable connection-based protocol with acknowledgments and hand-shaking. Other protocols might also be available such as UDP, which is a connectionless "send and forget" protocol.
For HTTP, a typical socket specifies TCP, the server IP address, and port 80. For HTTPS, port number 443 is usually used. UDP sockets are generally 1024 or higher.
The socketpool
module provides sockets through a pool of available sockets. When you are finished using a socket, it is returned to the pool. The pools themselves act like CPython’s socket
module.
Only one socket pool can be created for each radio.
Due to the smaller memory size of most microcontrollers and single board computers, the amount of memory available for sockets is limited. Depending on the memory usage, the number of available sockets in the pool may be exhausted. You will need to use proper management of available sockets in a socketpool.
Detailed information on functions and parameters may be found in the CircuitPython documentation.
Secure Sockets Layer (SSL) is a way of encrypting data that is transmitted over a network, to make the connection secure. SSL evolved into TLS (Transport Layer Security), and the mechanism is now often called SSL/TLS.
One of the most common uses for SSL/TLS is HTTPS, a secure way of making HTTP web requests. SSL/TLS in CircuitPython helps establish a secure HTTPS connection between a CircuitPython device and a secure internet server running HTTPS, now used by most of the web.
In the early days of microcontroller WiFi use, only insecure HTTP requests could be made. When the internet switched over to HTTPS due to threats around 2016, it left those older implementations without connections.
SSL/TLS provides authentication and encryption by using public-key cryptography. The public keys are known as certificates. The public keys have corresponding private keys that are kept secret. Trusted certificate providers issue root certificates. Other certificates are derived from the limited number of root certificates. A set of root certificates is usually stored in the WiFi firmware to allow connection to HTTPS servers whose certificates are based on those roots. You can also supply your own certificates.
Espressif discusses the certificates for ESP products here.
You may see examples of the response
Module using JSON to send and receive data.
Text editor powered by tinymce.