// Connect network interface
result = network->connect();
if (result != NSAPI_ERROR_OK) {
pc.printf("Error! network->connect() returned: %d\r\n", result);
}
The docs from OS 5.15 (and the warning from Mbed Studio) say that the string-based initialisation in set_network is deprecated & I should use SocketAddress objects instead. However in the SocketAddress docs I can’t find how to create/assign the netmask & default gateway. There appear to only be ip_address, network_stack and port_no methods.
Do I just create 3 SocketAddress objects named for example ‘ip’, mask’, ‘gw’ with respective ‘ip_address’ values corresponding to the ip address, netmask & gateway strings then call set_network(ip, mask, gw)?
Hello Chris,
I think you are right, you can either create three SocketAddress objects in advance and then call set_network or you can combine everything in one expression and create three temporary objects as arguments when calling set_network:
The last warnings I’m getting are in the ‘http_server.h’ header file from
which I’m using in my project for the webserver functionality I need.
It’s declaring a TCPServer (line 58 or so) that’s raising a deprecated warning, along with the associated TCPServer::accept() call in line 154.
The Mbed docs (and compiler warnings) say that TCPSocket should be used instead of TCPServer but I don’t have the understanding to adapt this code as it is already using other TCPSocket objects liberally.
I was able to get it to compile by re-declaring the ‘server’ object as TCPSocket and modifying the ::accept call, but the binary crashes on my target (EA LPC4088 QSB).