Counter

Dependencies:   EthernetInterface NTPClient SDFileSystem TextLCD WebSocketClient mbed-rtos mbed Socket lwip-eth lwip-sys lwip FATFileSystem

Committer:
Tuxitheone
Date:
Mon Feb 29 18:59:15 2016 +0000
Revision:
0:ecaf3e593122
TankCounter

Who changed what in which revision?

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