diff --git a/UNITTESTS/features/netsocket/TCPSocket/test_TCPSocket.cpp b/UNITTESTS/features/netsocket/TCPSocket/test_TCPSocket.cpp index abd7cc41eb..6dcd1999ab 100644 --- a/UNITTESTS/features/netsocket/TCPSocket/test_TCPSocket.cpp +++ b/UNITTESTS/features/netsocket/TCPSocket/test_TCPSocket.cpp @@ -62,7 +62,8 @@ TEST_F(TestTCPSocket, constructor) TEST_F(TestTCPSocket, constructor_parameters) { - TCPSocket socketParam = TCPSocket(dynamic_cast(&stack)); + TCPSocket socketParam = TCPSocket(); + socketParam.open(dynamic_cast(&stack)); const SocketAddress a("127.0.0.1", 1024); EXPECT_EQ(socketParam.connect(a), NSAPI_ERROR_OK); } diff --git a/features/netsocket/TCPSocket.h b/features/netsocket/TCPSocket.h index bde477cafb..c52a5fc094 100644 --- a/features/netsocket/TCPSocket.h +++ b/features/netsocket/TCPSocket.h @@ -42,8 +42,14 @@ public: * network interface. * * @param stack Network stack as target for socket + * + * @deprecated since mbed-os-5.11 */ template + MBED_DEPRECATED_SINCE("mbed-os-5.11", + "The TCPSocket(S *stack) constructor is deprecated." + "It discards the open() call return value." + "Use another constructor and call open() explicitly, instead.") TCPSocket(S *stack) { open(stack); diff --git a/features/netsocket/TLSSocket.h b/features/netsocket/TLSSocket.h index 3a759dc9e9..3ef47c0999 100644 --- a/features/netsocket/TLSSocket.h +++ b/features/netsocket/TLSSocket.h @@ -45,22 +45,6 @@ public: */ virtual ~TLSSocket(); - /** Create a socket on a network interface - * - * Creates and opens a socket on the network stack of the given - * network interface. - * If hostname is also given, user is not required to call set_hostname() later. - * - * @param stack Network stack as target for socket - * @param hostname Hostname used for certificate verification - */ - template - TLSSocket(S *stack, const char *hostname = NULL) : TLSSocketWrapper(&tcp_socket, hostname) - { - nsapi_error_t ret = tcp_socket.open(stack); - MBED_ASSERT(ret == NSAPI_ERROR_OK); - } - /** Opens a socket * * Creates a network socket on the network stack of the given diff --git a/features/netsocket/UDPSocket.h b/features/netsocket/UDPSocket.h index 49a90fd75a..44025389d2 100644 --- a/features/netsocket/UDPSocket.h +++ b/features/netsocket/UDPSocket.h @@ -41,8 +41,13 @@ public: * * @tparam S Type of the Network stack. * @param stack Network stack as target for socket. + * @deprecated since mbed-os-5.11 */ template + MBED_DEPRECATED_SINCE("mbed-os-5.11", + "The UDPSocket(S *stack) constructor is deprecated" + "It discards the open() call return value." + "Use another constructor and call open() explicitly, instead.") UDPSocket(S *stack) { open(stack);