Onenet

Dependents:   K64F_eCompass_OneNET_JW

Committer:
robert_jw
Date:
Mon Jun 20 01:40:20 2016 +0000
Revision:
0:b2805b6888dc
ADS

Who changed what in which revision?

UserRevisionLine numberNew contents of line
robert_jw 0:b2805b6888dc 1 /* Copyright (C) 2012 mbed.org, MIT License
robert_jw 0:b2805b6888dc 2 *
robert_jw 0:b2805b6888dc 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
robert_jw 0:b2805b6888dc 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
robert_jw 0:b2805b6888dc 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
robert_jw 0:b2805b6888dc 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
robert_jw 0:b2805b6888dc 7 * furnished to do so, subject to the following conditions:
robert_jw 0:b2805b6888dc 8 *
robert_jw 0:b2805b6888dc 9 * The above copyright notice and this permission notice shall be included in all copies or
robert_jw 0:b2805b6888dc 10 * substantial portions of the Software.
robert_jw 0:b2805b6888dc 11 *
robert_jw 0:b2805b6888dc 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
robert_jw 0:b2805b6888dc 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
robert_jw 0:b2805b6888dc 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
robert_jw 0:b2805b6888dc 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
robert_jw 0:b2805b6888dc 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
robert_jw 0:b2805b6888dc 17 */
robert_jw 0:b2805b6888dc 18 #ifndef TCPSOCKETSERVER_H
robert_jw 0:b2805b6888dc 19 #define TCPSOCKETSERVER_H
robert_jw 0:b2805b6888dc 20
robert_jw 0:b2805b6888dc 21 #include "Socket/Socket.h"
robert_jw 0:b2805b6888dc 22 #include "TCPSocketConnection.h"
robert_jw 0:b2805b6888dc 23
robert_jw 0:b2805b6888dc 24 /** TCP Server.
robert_jw 0:b2805b6888dc 25 */
robert_jw 0:b2805b6888dc 26 class TCPSocketServer : public Socket {
robert_jw 0:b2805b6888dc 27 public:
robert_jw 0:b2805b6888dc 28 /** Instantiate a TCP Server.
robert_jw 0:b2805b6888dc 29 */
robert_jw 0:b2805b6888dc 30 TCPSocketServer();
robert_jw 0:b2805b6888dc 31
robert_jw 0:b2805b6888dc 32 /** Bind a socket to a specific port.
robert_jw 0:b2805b6888dc 33 \param port The port to listen for incoming connections on.
robert_jw 0:b2805b6888dc 34 \return 0 on success, -1 on failure.
robert_jw 0:b2805b6888dc 35 */
robert_jw 0:b2805b6888dc 36 int bind(int port);
robert_jw 0:b2805b6888dc 37
robert_jw 0:b2805b6888dc 38 /** Start listening for incoming connections.
robert_jw 0:b2805b6888dc 39 \param backlog number of pending connections that can be queued up at any
robert_jw 0:b2805b6888dc 40 one time [Default: 1].
robert_jw 0:b2805b6888dc 41 \return 0 on success, -1 on failure.
robert_jw 0:b2805b6888dc 42 */
robert_jw 0:b2805b6888dc 43 int listen(int backlog=1);
robert_jw 0:b2805b6888dc 44
robert_jw 0:b2805b6888dc 45 /** Accept a new connection.
robert_jw 0:b2805b6888dc 46 \param connection A TCPSocketConnection instance that will handle the incoming connection.
robert_jw 0:b2805b6888dc 47 \return 0 on success, -1 on failure.
robert_jw 0:b2805b6888dc 48 */
robert_jw 0:b2805b6888dc 49 int accept(TCPSocketConnection& connection);
robert_jw 0:b2805b6888dc 50 };
robert_jw 0:b2805b6888dc 51
robert_jw 0:b2805b6888dc 52 #endif