Host library for controlling a WiConnect enabled Wi-Fi module.

Dependents:   wiconnect-ota_example wiconnect-web_setup_example wiconnect-test-console wiconnect-tcp_server_example ... more

Committer:
dan_ackme
Date:
Sat Aug 23 05:39:17 2014 -0700
Revision:
17:7268f365676b
Fixes and documentation updates

Who changed what in which revision?

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