Is it possible to upgrade a TCP socket created using the new socket interface to a TLS connection similar how it’s done with gen_tcp?
Providing that gen_tcp is configured to run the new inet-backend that should work!
Interesting, @ingela can you explain more?
The reason I ask is that we are starting to implement the socket
API for AtomVM, using the BSD socket interfaces provided by the ESP32. (We also have a netconn implementation, but that is not officially supported by Espressif).
It occurred to me that we could re-implement our gen_tcp
and gen_udp
implementations using the socket API, as opposed to our existing native “port”, which uses the OS-level APIs, directly (via a C interface). Is that the same general idea as your inet-backend?
Oh, great! I completely missed it in the specs that the gen_tcp backends are now configurable! Was that added in version 24 or 25?
For gen_tcp
, in 23 already IIRC. But ssl
didn’t support it while it was still experimental.
It was not supported by ssl at the beginning as some socket handling code needed to be changed in order for it to work under all circumstances. This should be done in the latest OTP-24, but when running ssl tests with the new socket backend some problems in the socket backend have been revealed and I am not sure if they all were fixed in the OTP-24 track.
Yes, it sounds the same. Our long-term goal is to get rid of the inet-driver and use the socket-API instead. And gen_tcp, gen_udp, etc need to keep working.