Warning: 'connect' is deprecated: String-based APIs are deprecated [since mbed-os-5.15]

Not sure if there is a documentation issue or problem with the library.
Socket Connect is depreciated?

code below is a snip from the Mbed documents example:


printf("Connecting to ifconfig.io\n");
result = socket->connect("ifconfig.io", 443);
if (result != 0) {
    printf("Error! socket->connect() returned: %d\n", result);
    goto DISCONNECT;

I believe there is a lot of out dated information in the Mbed Documents, could I please ask again if someone could update these documents to reflect changes as they happen. It would save a lot of stupid questions (particularly from me).



Hi @star297
Thank you for putting this into our attention.
I agree with you that changes should be reflected in the documentation. Please note that sometimes, things get missed though.
I have created an issue in the example repository.
However, I tried building the example with both ARMC6 and GCC_ARM toolchains, and didn’t get th9is compilation warning.
Could you add more details?
Mbed Support

Hi @star297
The example has already been fixed, but not released yet, so I believe the documentation will be updated once the example is updated

Thank you Ron,
It’s with the online compiler(I do tend to update Mbed to the latest version as I go) and I used this snip to overcome the warning in the ‘http example’ code i’m using.
But no worries, don’t waste your time, if its in the pipe line then I can sort it at a later date.

I know you’re a TLS expert but I think there’s a few issues with some other users along with me with these depreciated string-based API’s, perhaps you could poke someone to do a quick round up with the changes and post it somewhere so we can get the best out of these API’s?
Saves a lot of wasted questions.


HI @star297
What is missing from this release note in the string based API deprecation section?

Some kind of examples Ron , yes I read whats going to go, but I and others are not sure what to do to replace these functions:

TCPServer (whole class is deprecated already)
TCPSocket::connect(const char *host, uint16_t port);
TLSSocket::connect(const char *host, uint16_t port);
DTLSSocket::connect(const char *host, uint16_t port)
InternetDatagramSocket::sendto(const char *host, uint16_t port, data, size);
InternetSocket::bind(const char *address, uint16_t port);
L3IP:add_ipv4_multicast_group(const char *address);
L3IP:add_ipv6_multicast_group(const char *address)
L3IP:remove_ipv4_multicast_group(const char *address);
L3IP:remove_ipv6_multicast_group(const char *address)
NetworkInterface::set_network(const char *ip_address, const char *netmask, const char *gateway)

See if someone can update this:


It’s quite popular and I managed to work it all out and use a lot of the example code in a short space of time and I’m a hardware engineer not software.
It would be beneficial to Mbed staff to save a lot of questions here.

HI @star297
Thanks for the feedback.
I agree that some examples might need updating, and it was probably missed during the release by mistake.
I apologize for inconvenience.