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