mirror of https://github.com/ARMmbed/mbed-os.git
Netsocket: Remove deprecated TCPServer
TCPSocket should be used instead.pull/12694/head
parent
e1daa7906d
commit
236054175b
|
|
@ -1,98 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2018, Arm Limited and affiliates
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
#include "features/netsocket/TCPSocket.h"
|
|
||||||
#include "features/netsocket/TCPServer.h"
|
|
||||||
#include "NetworkStack_stub.h"
|
|
||||||
|
|
||||||
// Control the rtos EventFlags stub. See EventFlags_stub.cpp
|
|
||||||
extern std::list<uint32_t> eventFlagsStubNextRetval;
|
|
||||||
|
|
||||||
class TestTCPServer : public testing::Test {
|
|
||||||
public:
|
|
||||||
unsigned int dataSize = 10;
|
|
||||||
char dataBuf[10];
|
|
||||||
protected:
|
|
||||||
TCPSocket *socket;
|
|
||||||
TCPServer *server;
|
|
||||||
NetworkStackstub stack;
|
|
||||||
|
|
||||||
virtual void SetUp()
|
|
||||||
{
|
|
||||||
server = new TCPServer();
|
|
||||||
socket = new TCPSocket();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void TearDown()
|
|
||||||
{
|
|
||||||
stack.return_values.clear();
|
|
||||||
eventFlagsStubNextRetval.clear();
|
|
||||||
delete socket;
|
|
||||||
delete server;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
TEST_F(TestTCPServer, constructor)
|
|
||||||
{
|
|
||||||
EXPECT_TRUE(server);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(TestTCPServer, constructor_parameters)
|
|
||||||
{
|
|
||||||
TCPServer serverParam(&stack);
|
|
||||||
const SocketAddress a("127.0.0.1", 1024);
|
|
||||||
EXPECT_EQ(serverParam.connect(a), NSAPI_ERROR_OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(TestTCPServer, accept)
|
|
||||||
{
|
|
||||||
const SocketAddress a("127.0.0.1", 1024);
|
|
||||||
EXPECT_EQ(socket->open(&stack), NSAPI_ERROR_OK);
|
|
||||||
EXPECT_EQ(socket->connect(a), NSAPI_ERROR_OK);
|
|
||||||
nsapi_error_t error;
|
|
||||||
EXPECT_EQ(server->open(&stack), NSAPI_ERROR_OK);
|
|
||||||
EXPECT_EQ(server->bind(a), NSAPI_ERROR_OK);
|
|
||||||
server->listen(1);
|
|
||||||
SocketAddress client_addr;
|
|
||||||
EXPECT_EQ(server->accept(socket, &client_addr), NSAPI_ERROR_OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(TestTCPServer, accept_no_socket)
|
|
||||||
{
|
|
||||||
SocketAddress client_addr;
|
|
||||||
EXPECT_EQ(server->accept(socket, &client_addr), NSAPI_ERROR_NO_SOCKET);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(TestTCPServer, accept_error)
|
|
||||||
{
|
|
||||||
SocketAddress client_addr;
|
|
||||||
EXPECT_EQ(server->open(&stack), NSAPI_ERROR_OK);
|
|
||||||
stack.return_value = NSAPI_ERROR_AUTH_FAILURE;
|
|
||||||
EXPECT_EQ(server->accept(socket, &client_addr), NSAPI_ERROR_AUTH_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(TestTCPServer, accept_error_would_block)
|
|
||||||
{
|
|
||||||
SocketAddress client_addr;
|
|
||||||
EXPECT_EQ(server->open(&stack), NSAPI_ERROR_OK);
|
|
||||||
stack.return_value = NSAPI_ERROR_WOULD_BLOCK;
|
|
||||||
eventFlagsStubNextRetval.push_back(0);
|
|
||||||
eventFlagsStubNextRetval.push_back(osFlagsError); // Break the wait loop
|
|
||||||
|
|
||||||
EXPECT_EQ(server->accept(socket, &client_addr), NSAPI_ERROR_WOULD_BLOCK);
|
|
||||||
}
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
|
|
||||||
####################
|
|
||||||
# UNIT TESTS
|
|
||||||
####################
|
|
||||||
|
|
||||||
# Unit test suite name
|
|
||||||
set(TEST_SUITE_NAME "features_netsocket_TCPServer")
|
|
||||||
|
|
||||||
set(unittest-sources
|
|
||||||
../features/netsocket/SocketAddress.cpp
|
|
||||||
../features/netsocket/NetworkStack.cpp
|
|
||||||
../features/netsocket/InternetSocket.cpp
|
|
||||||
../features/netsocket/TCPSocket.cpp
|
|
||||||
../features/netsocket/TCPServer.cpp
|
|
||||||
../features/frameworks/nanostack-libservice/source/libip4string/ip4tos.c
|
|
||||||
../features/frameworks/nanostack-libservice/source/libip6string/ip6tos.c
|
|
||||||
../features/frameworks/nanostack-libservice/source/libip4string/stoip4.c
|
|
||||||
../features/frameworks/nanostack-libservice/source/libip6string/stoip6.c
|
|
||||||
../features/frameworks/nanostack-libservice/source/libBits/common_functions.c
|
|
||||||
)
|
|
||||||
|
|
||||||
set(unittest-test-sources
|
|
||||||
stubs/Mutex_stub.cpp
|
|
||||||
stubs/mbed_assert_stub.cpp
|
|
||||||
stubs/mbed_atomic_stub.c
|
|
||||||
stubs/mbed_critical_stub.c
|
|
||||||
stubs/equeue_stub.c
|
|
||||||
stubs/EventQueue_stub.cpp
|
|
||||||
stubs/mbed_error.c
|
|
||||||
stubs/mbed_shared_queues_stub.cpp
|
|
||||||
stubs/nsapi_dns_stub.cpp
|
|
||||||
stubs/EventFlags_stub.cpp
|
|
||||||
features/netsocket/TCPServer/test_TCPServer.cpp
|
|
||||||
stubs/SocketStats_Stub.cpp
|
|
||||||
)
|
|
||||||
|
|
@ -49,6 +49,33 @@ protected:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Control the rtos EventFlags stub. See EventFlags_stub.cpp
|
||||||
|
extern std::list<uint32_t> eventFlagsStubNextRetval;
|
||||||
|
|
||||||
|
class TestTCPServer : public testing::Test {
|
||||||
|
public:
|
||||||
|
unsigned int dataSize = 10;
|
||||||
|
char dataBuf[10];
|
||||||
|
protected:
|
||||||
|
TCPSocket *socket;
|
||||||
|
TCPSocket *server;
|
||||||
|
NetworkStackstub stack;
|
||||||
|
|
||||||
|
virtual void SetUp()
|
||||||
|
{
|
||||||
|
server = new TCPSocket();
|
||||||
|
socket = new TCPSocket();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void TearDown()
|
||||||
|
{
|
||||||
|
stack.return_values.clear();
|
||||||
|
eventFlagsStubNextRetval.clear();
|
||||||
|
delete socket;
|
||||||
|
delete server;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
TEST_F(TestTCPSocket, get_proto)
|
TEST_F(TestTCPSocket, get_proto)
|
||||||
{
|
{
|
||||||
TCPSocketFriend tcpFriend;
|
TCPSocketFriend tcpFriend;
|
||||||
|
|
@ -231,6 +258,12 @@ TEST_F(TestTCPSocket, recv_from_null)
|
||||||
EXPECT_EQ(socket->recvfrom(NULL, dataBuf, dataSize), NSAPI_ERROR_OK);
|
EXPECT_EQ(socket->recvfrom(NULL, dataBuf, dataSize), NSAPI_ERROR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(TestTCPSocket, unsupported_api)
|
||||||
|
{
|
||||||
|
SocketAddress addr;
|
||||||
|
EXPECT_EQ(socket->join_multicast_group(addr), NSAPI_ERROR_UNSUPPORTED);
|
||||||
|
}
|
||||||
|
|
||||||
/* listen */
|
/* listen */
|
||||||
|
|
||||||
TEST_F(TestTCPSocket, listen_no_open)
|
TEST_F(TestTCPSocket, listen_no_open)
|
||||||
|
|
@ -246,9 +279,9 @@ TEST_F(TestTCPSocket, listen)
|
||||||
EXPECT_EQ(socket->listen(1), NSAPI_ERROR_OK);
|
EXPECT_EQ(socket->listen(1), NSAPI_ERROR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* these tests will have to be readjusted after TCPServer is deprecated. */
|
/* TCP server */
|
||||||
|
|
||||||
TEST_F(TestTCPSocket, accept_no_open)
|
TEST_F(TestTCPServer, accept_no_open)
|
||||||
{
|
{
|
||||||
nsapi_error_t error;
|
nsapi_error_t error;
|
||||||
stack.return_value = NSAPI_ERROR_OK;
|
stack.return_value = NSAPI_ERROR_OK;
|
||||||
|
|
@ -256,12 +289,17 @@ TEST_F(TestTCPSocket, accept_no_open)
|
||||||
EXPECT_EQ(error, NSAPI_ERROR_NO_SOCKET);
|
EXPECT_EQ(error, NSAPI_ERROR_NO_SOCKET);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TestTCPSocket, accept)
|
TEST_F(TestTCPServer, accept)
|
||||||
{
|
{
|
||||||
|
const SocketAddress a("127.0.0.1", 1024);
|
||||||
|
EXPECT_EQ(socket->open(&stack), NSAPI_ERROR_OK);
|
||||||
|
EXPECT_EQ(socket->connect(a), NSAPI_ERROR_OK);
|
||||||
nsapi_error_t error;
|
nsapi_error_t error;
|
||||||
stack.return_value = NSAPI_ERROR_OK;
|
EXPECT_EQ(server->open(&stack), NSAPI_ERROR_OK);
|
||||||
|
EXPECT_EQ(server->bind(a), NSAPI_ERROR_OK);
|
||||||
|
server->listen(1);
|
||||||
socket->open(&stack);
|
socket->open(&stack);
|
||||||
TCPSocket *sock = socket->accept(&error);
|
TCPSocket *sock = server->accept(&error);
|
||||||
EXPECT_NE(sock, nullptr);
|
EXPECT_NE(sock, nullptr);
|
||||||
EXPECT_EQ(error, NSAPI_ERROR_OK);
|
EXPECT_EQ(error, NSAPI_ERROR_OK);
|
||||||
if (sock) {
|
if (sock) {
|
||||||
|
|
@ -269,19 +307,26 @@ TEST_F(TestTCPSocket, accept)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TestTCPSocket, accept_would_block)
|
TEST_F(TestTCPServer, accept_would_block)
|
||||||
{
|
{
|
||||||
nsapi_error_t error;
|
nsapi_error_t error;
|
||||||
socket->open(&stack);
|
socket->open(&stack);
|
||||||
|
EXPECT_EQ(server->open(&stack), NSAPI_ERROR_OK);
|
||||||
|
|
||||||
stack.return_value = NSAPI_ERROR_WOULD_BLOCK;
|
stack.return_value = NSAPI_ERROR_WOULD_BLOCK;
|
||||||
eventFlagsStubNextRetval.push_back(0);
|
eventFlagsStubNextRetval.push_back(0);
|
||||||
eventFlagsStubNextRetval.push_back(osFlagsError); // Break the wait loop
|
eventFlagsStubNextRetval.push_back(osFlagsError); // Break the wait loop
|
||||||
|
|
||||||
EXPECT_EQ(socket->accept(&error), nullptr);
|
EXPECT_EQ(socket->accept(&error), nullptr);
|
||||||
EXPECT_EQ(error, NSAPI_ERROR_WOULD_BLOCK);
|
EXPECT_EQ(error, NSAPI_ERROR_WOULD_BLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TestTCPSocket, unsupported_api)
|
TEST_F(TestTCPServer, accept_error)
|
||||||
{
|
{
|
||||||
SocketAddress addr;
|
nsapi_error_t error;
|
||||||
EXPECT_EQ(socket->join_multicast_group(addr), NSAPI_ERROR_UNSUPPORTED);
|
EXPECT_EQ(server->open(&stack), NSAPI_ERROR_OK);
|
||||||
|
stack.return_value = NSAPI_ERROR_AUTH_FAILURE;
|
||||||
|
TCPSocket *sock = server->accept(&error);
|
||||||
|
EXPECT_EQ(server->accept(&error), nullptr);
|
||||||
|
EXPECT_EQ(error, NSAPI_ERROR_AUTH_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@
|
||||||
|
|
||||||
#define MEM_SIZE MBED_CONF_LWIP_MEM_SIZE
|
#define MEM_SIZE MBED_CONF_LWIP_MEM_SIZE
|
||||||
|
|
||||||
// One tcp_pcb_listen is needed for each TCPServer.
|
// One tcp_pcb_listen is needed for each TCP server.
|
||||||
// Each requires 72 bytes of RAM.
|
// Each requires 72 bytes of RAM.
|
||||||
#define MEMP_NUM_TCP_PCB_LISTEN MBED_CONF_LWIP_TCP_SERVER_MAX
|
#define MEMP_NUM_TCP_PCB_LISTEN MBED_CONF_LWIP_TCP_SERVER_MAX
|
||||||
|
|
||||||
|
|
@ -172,7 +172,7 @@
|
||||||
// Each netbuf requires 64 bytes of RAM.
|
// Each netbuf requires 64 bytes of RAM.
|
||||||
#define MEMP_NUM_NETBUF MBED_CONF_LWIP_NUM_NETBUF
|
#define MEMP_NUM_NETBUF MBED_CONF_LWIP_NUM_NETBUF
|
||||||
|
|
||||||
// One netconn is needed for each UDPSocket, TCPSocket or TCPServer.
|
// One netconn is needed for each UDPSocket or TCPSocket.
|
||||||
// Each requires 236 bytes of RAM (total rounded to multiple of 512).
|
// Each requires 236 bytes of RAM (total rounded to multiple of 512).
|
||||||
#define MEMP_NUM_NETCONN MBED_CONF_LWIP_SOCKET_MAX
|
#define MEMP_NUM_NETCONN MBED_CONF_LWIP_SOCKET_MAX
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@
|
||||||
"value": false
|
"value": false
|
||||||
},
|
},
|
||||||
"socket-max": {
|
"socket-max": {
|
||||||
"help": "Maximum number of open TCPServer, TCPSocket and UDPSocket instances allowed, including one used internally for DNS. Each requires 236 bytes of pre-allocated RAM",
|
"help": "Maximum number of open TCPSocket and UDPSocket instances allowed, including one used internally for DNS. Each requires 236 bytes of pre-allocated RAM",
|
||||||
"value": 4
|
"value": 4
|
||||||
},
|
},
|
||||||
"tcp-enabled": {
|
"tcp-enabled": {
|
||||||
|
|
@ -67,7 +67,7 @@
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"tcp-server-max": {
|
"tcp-server-max": {
|
||||||
"help": "Maximum number of open TCPServer instances allowed. Each requires 72 bytes of pre-allocated RAM",
|
"help": "Maximum number of open TCP server instances allowed. Each requires 72 bytes of pre-allocated RAM",
|
||||||
"value": 4
|
"value": 4
|
||||||
},
|
},
|
||||||
"tcp-socket-max": {
|
"tcp-socket-max": {
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,6 @@ protected:
|
||||||
friend class InternetSocket;
|
friend class InternetSocket;
|
||||||
friend class InternetDatagramSocket;
|
friend class InternetDatagramSocket;
|
||||||
friend class TCPSocket;
|
friend class TCPSocket;
|
||||||
friend class TCPServer;
|
|
||||||
|
|
||||||
/** Opens a socket
|
/** Opens a socket
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,75 +0,0 @@
|
||||||
/* Socket
|
|
||||||
* Copyright (c) 2015 ARM Limited
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "TCPServer.h"
|
|
||||||
|
|
||||||
TCPServer::TCPServer()
|
|
||||||
{
|
|
||||||
_socket_stats.stats_update_proto(this, NSAPI_TCP);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsapi_error_t TCPServer::accept(TCPSocket *connection, SocketAddress *address)
|
|
||||||
{
|
|
||||||
_lock.lock();
|
|
||||||
nsapi_error_t ret;
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
if (!_socket) {
|
|
||||||
ret = NSAPI_ERROR_NO_SOCKET;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
core_util_atomic_flag_clear(&_pending);
|
|
||||||
void *socket;
|
|
||||||
ret = _stack->socket_accept(_socket, &socket, address);
|
|
||||||
|
|
||||||
if (0 == ret) {
|
|
||||||
connection->_lock.lock();
|
|
||||||
|
|
||||||
if (connection->_socket) {
|
|
||||||
connection->close();
|
|
||||||
}
|
|
||||||
|
|
||||||
connection->_stack = _stack;
|
|
||||||
connection->_socket = socket;
|
|
||||||
connection->_event = { connection, &TCPSocket::event };
|
|
||||||
_stack->socket_attach(socket, connection->_event.thunk, &connection->_event);
|
|
||||||
_socket_stats.stats_update_peer(connection, *address);
|
|
||||||
_socket_stats.stats_update_socket_state(connection, SOCK_CONNECTED);
|
|
||||||
connection->_lock.unlock();
|
|
||||||
break;
|
|
||||||
} else if ((_timeout == 0) || (ret != NSAPI_ERROR_WOULD_BLOCK)) {
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
uint32_t flag;
|
|
||||||
|
|
||||||
// Release lock before blocking so other threads
|
|
||||||
// accessing this object aren't blocked
|
|
||||||
_lock.unlock();
|
|
||||||
flag = _event_flag.wait_any(READ_FLAG, _timeout);
|
|
||||||
_lock.lock();
|
|
||||||
|
|
||||||
if (flag & osFlagsError) {
|
|
||||||
// Timeout break
|
|
||||||
ret = NSAPI_ERROR_WOULD_BLOCK;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_lock.unlock();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
@ -1,81 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2015 ARM Limited
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @file TCPServer.h Deprecated TCPServer class */
|
|
||||||
/** \addtogroup netsocket
|
|
||||||
* @{*/
|
|
||||||
|
|
||||||
#ifndef TCPSERVER_H
|
|
||||||
#define TCPSERVER_H
|
|
||||||
|
|
||||||
#include "netsocket/InternetSocket.h"
|
|
||||||
#include "netsocket/TCPSocket.h"
|
|
||||||
#include "netsocket/NetworkStack.h"
|
|
||||||
#include "netsocket/NetworkInterface.h"
|
|
||||||
|
|
||||||
|
|
||||||
/** TCP socket server
|
|
||||||
*/
|
|
||||||
class TCPServer : public TCPSocket {
|
|
||||||
public:
|
|
||||||
/** Create an uninitialized socket
|
|
||||||
*
|
|
||||||
* Must call open to initialize the socket on a network stack.
|
|
||||||
*/
|
|
||||||
MBED_DEPRECATED_SINCE("mbed-os-5.10",
|
|
||||||
"TCPServer is deprecated, use TCPSocket")
|
|
||||||
TCPServer();
|
|
||||||
|
|
||||||
/** Create a socket on a network interface
|
|
||||||
*
|
|
||||||
* Creates and opens a socket on the network stack of the given
|
|
||||||
* network interface.
|
|
||||||
*
|
|
||||||
* @param stack Network stack as target for socket
|
|
||||||
*/
|
|
||||||
template <typename S>
|
|
||||||
MBED_DEPRECATED_SINCE("mbed-os-5.10",
|
|
||||||
"TCPServer is deprecated, use TCPSocket")
|
|
||||||
TCPServer(S *stack)
|
|
||||||
{
|
|
||||||
open(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allow legacy TCPServer::accept() to override inherited Socket::accept()
|
|
||||||
using TCPSocket::accept;
|
|
||||||
|
|
||||||
/** Accepts a connection on a TCP socket
|
|
||||||
*
|
|
||||||
* The server socket must be bound and set to listen for connections.
|
|
||||||
* On a new connection, creates a network socket using the specified
|
|
||||||
* socket instance.
|
|
||||||
*
|
|
||||||
* By default, accept blocks until data is sent. If socket is set to
|
|
||||||
* non-blocking or times out, NSAPI_ERROR_WOULD_BLOCK is returned
|
|
||||||
* immediately.
|
|
||||||
*
|
|
||||||
* @param connection TCPSocket instance that will handle the incoming connection.
|
|
||||||
* @param address Destination for the remote address or NULL
|
|
||||||
* @return 0 on success, negative error code on failure
|
|
||||||
*/
|
|
||||||
MBED_DEPRECATED_SINCE("mbed-os-5.10",
|
|
||||||
"TCPServer::accept() is deprecated, use Socket *Socket::accept() instead")
|
|
||||||
nsapi_error_t accept(TCPSocket *connection, SocketAddress *address = NULL);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** @} */
|
|
||||||
|
|
@ -177,7 +177,6 @@ public:
|
||||||
nsapi_error_t listen(int backlog = 1) override;
|
nsapi_error_t listen(int backlog = 1) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class TCPServer;
|
|
||||||
nsapi_protocol_t get_proto() override;
|
nsapi_protocol_t get_proto() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@
|
||||||
#include "netsocket/Socket.h"
|
#include "netsocket/Socket.h"
|
||||||
#include "netsocket/UDPSocket.h"
|
#include "netsocket/UDPSocket.h"
|
||||||
#include "netsocket/TCPSocket.h"
|
#include "netsocket/TCPSocket.h"
|
||||||
#include "netsocket/TCPServer.h"
|
|
||||||
#include "netsocket/TLSSocketWrapper.h"
|
#include "netsocket/TLSSocketWrapper.h"
|
||||||
#include "netsocket/DTLSSocketWrapper.h"
|
#include "netsocket/DTLSSocketWrapper.h"
|
||||||
#include "netsocket/TLSSocket.h"
|
#include "netsocket/TLSSocket.h"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue