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