]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/net/lwip/Socket/TCPSocketServer.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / net / lwip / Socket / TCPSocketServer.h
1 /* Copyright (C) 2012 mbed.org, MIT License
2  *
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:
8  *
9  * The above copyright notice and this permission notice shall be included in all copies or
10  * substantial portions of the Software.
11  *
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.
17  */
18 #ifndef TCPSOCKETSERVER_H
19 #define TCPSOCKETSERVER_H
20
21 #include "Socket/Socket.h"
22 #include "TCPSocketConnection.h"
23
24 /** TCP Server.
25   */
26 class TCPSocketServer : public Socket {
27   public:
28     /** Instantiate a TCP Server.
29     */
30     TCPSocketServer();
31     
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.
35     */
36     int bind(int port);
37     
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.
42     */
43     int listen(int backlog=1);
44     
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.
48     */
49     int accept(TCPSocketConnection& connection);
50 };
51
52 #endif