Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
TCPServer.h
00001 /* 00002 * Copyright (c) 2015 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 /** @file TCPServer.h Deprecated TCPServer class */ 00018 /** \addtogroup netsocket 00019 * @{*/ 00020 00021 #ifndef TCPSERVER_H 00022 #define TCPSERVER_H 00023 00024 #include "netsocket/InternetSocket.h" 00025 #include "netsocket/TCPSocket.h" 00026 #include "netsocket/NetworkStack.h" 00027 #include "netsocket/NetworkInterface.h" 00028 00029 00030 /** TCP socket server 00031 */ 00032 class TCPServer : public TCPSocket { 00033 public: 00034 /** Create an uninitialized socket 00035 * 00036 * Must call open to initialize the socket on a network stack. 00037 */ 00038 MBED_DEPRECATED_SINCE("mbed-os-5.10", 00039 "TCPServer is deprecated, use TCPSocket") 00040 TCPServer(); 00041 00042 /** Create a socket on a network interface 00043 * 00044 * Creates and opens a socket on the network stack of the given 00045 * network interface. 00046 * 00047 * @param stack Network stack as target for socket 00048 */ 00049 template <typename S> 00050 MBED_DEPRECATED_SINCE("mbed-os-5.10", 00051 "TCPServer is deprecated, use TCPSocket") 00052 TCPServer(S *stack) 00053 { 00054 open(stack); 00055 } 00056 00057 /** Destroy a socket 00058 * 00059 * Closes socket if the socket is still open 00060 */ 00061 virtual ~TCPServer(); 00062 00063 // Allow legacy TCPServer::accept() to override inherited Socket::accept() 00064 using TCPSocket::accept; 00065 00066 /** Accepts a connection on a TCP socket 00067 * 00068 * The server socket must be bound and set to listen for connections. 00069 * On a new connection, creates a network socket using the specified 00070 * socket instance. 00071 * 00072 * By default, accept blocks until data is sent. If socket is set to 00073 * non-blocking or times out, NSAPI_ERROR_WOULD_BLOCK is returned 00074 * immediately. 00075 * 00076 * @param connection TCPSocket instance that will handle the incoming connection. 00077 * @param address Destination for the remote address or NULL 00078 * @return 0 on success, negative error code on failure 00079 */ 00080 MBED_DEPRECATED_SINCE("mbed-os-5.10", 00081 "TCPServer::accept() is deprecated, use Socket *Socket::accept() instead") 00082 nsapi_error_t accept(TCPSocket *connection, SocketAddress *address = NULL); 00083 }; 00084 00085 #endif 00086 00087 /** @} */
Generated on Tue Jul 12 2022 13:54:55 by
