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: Seeed_GPRS_Library_HelloWorld Seeed_GPRS_Xively_HelloWorld Seeed_ARCH_GPRS_V2_Xively_HelloWorld Seeed_ARCH_GPRS_V2_ThingSpeak_HelloWorld ... more
TCPSocketServer.h
00001 /* 00002 TCPSocketServer.h 00003 2014 Copyright (c) Seeed Technology Inc. All right reserved. 00004 00005 Author:lawliet zou(lawliet.zou@gmail.com) 00006 2014-2-24 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Lesser General Public 00010 License as published by the Free Software Foundation; either 00011 version 2.1 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Lesser General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public 00019 License along with this library; if not, write to the Free Software 00020 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 #ifndef TCPSOCKETSERVER_H 00023 #define TCPSOCKETSERVER_H 00024 00025 #include "Socket/Socket.h" 00026 #include "TCPSocketConnection.h" 00027 00028 /** TCP Server. 00029 */ 00030 class TCPSocketServer : public Socket 00031 { 00032 public: 00033 /** Instantiate a TCP Server. 00034 */ 00035 TCPSocketServer(); 00036 00037 /** Bind a socket to a specific port. 00038 \param port The port to listen for incoming connections on. 00039 \return 0 on success, -1 on failure. 00040 */ 00041 int bind(int port); 00042 00043 /** Start listening for incoming connections. 00044 \param backlog number of pending connections that can be queued up at any 00045 one time [Default: 1]. 00046 \return 0 on success, -1 on failure. 00047 */ 00048 int listen(int backlog=1); 00049 00050 /** Accept a new connection. 00051 \param connection A TCPSocketConnection instance that will handle the incoming connection. 00052 \return 0 on success, -1 on failure. 00053 */ 00054 int accept(TCPSocketConnection& connection); 00055 }; 00056 00057 #endif
Generated on Thu Jul 14 2022 07:16:02 by
