posilani dat

Dependencies:   FatFileSystemCpp mbed PowerControl USBHostLite

Committer:
PavelKumpan
Date:
Tue May 23 18:42:14 2017 +0000
Revision:
26:5674b8978551
Parent:
7:805c16a071d0
Recreated communication protocol.

Who changed what in which revision?

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