Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
libraries/net/lwip/Socket/TCPSocketServer.h@0:6c56fb4bc5f0, 2016-11-04 (annotated)
- Committer:
- nexpaq
- Date:
- Fri Nov 04 20:27:58 2016 +0000
- Revision:
- 0:6c56fb4bc5f0
Moving to library for sharing updates
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| nexpaq | 0:6c56fb4bc5f0 | 1 | /* Copyright (C) 2012 mbed.org, MIT License |
| nexpaq | 0:6c56fb4bc5f0 | 2 | * |
| nexpaq | 0:6c56fb4bc5f0 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
| nexpaq | 0:6c56fb4bc5f0 | 4 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
| nexpaq | 0:6c56fb4bc5f0 | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
| nexpaq | 0:6c56fb4bc5f0 | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
| nexpaq | 0:6c56fb4bc5f0 | 7 | * furnished to do so, subject to the following conditions: |
| nexpaq | 0:6c56fb4bc5f0 | 8 | * |
| nexpaq | 0:6c56fb4bc5f0 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
| nexpaq | 0:6c56fb4bc5f0 | 10 | * substantial portions of the Software. |
| nexpaq | 0:6c56fb4bc5f0 | 11 | * |
| nexpaq | 0:6c56fb4bc5f0 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
| nexpaq | 0:6c56fb4bc5f0 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| nexpaq | 0:6c56fb4bc5f0 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
| nexpaq | 0:6c56fb4bc5f0 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| nexpaq | 0:6c56fb4bc5f0 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| nexpaq | 0:6c56fb4bc5f0 | 17 | */ |
| nexpaq | 0:6c56fb4bc5f0 | 18 | #ifndef TCPSOCKETSERVER_H |
| nexpaq | 0:6c56fb4bc5f0 | 19 | #define TCPSOCKETSERVER_H |
| nexpaq | 0:6c56fb4bc5f0 | 20 | |
| nexpaq | 0:6c56fb4bc5f0 | 21 | #include "Socket/Socket.h" |
| nexpaq | 0:6c56fb4bc5f0 | 22 | #include "TCPSocketConnection.h" |
| nexpaq | 0:6c56fb4bc5f0 | 23 | |
| nexpaq | 0:6c56fb4bc5f0 | 24 | /** TCP Server. |
| nexpaq | 0:6c56fb4bc5f0 | 25 | */ |
| nexpaq | 0:6c56fb4bc5f0 | 26 | class TCPSocketServer : public Socket { |
| nexpaq | 0:6c56fb4bc5f0 | 27 | public: |
| nexpaq | 0:6c56fb4bc5f0 | 28 | /** Instantiate a TCP Server. |
| nexpaq | 0:6c56fb4bc5f0 | 29 | */ |
| nexpaq | 0:6c56fb4bc5f0 | 30 | TCPSocketServer(); |
| nexpaq | 0:6c56fb4bc5f0 | 31 | |
| nexpaq | 0:6c56fb4bc5f0 | 32 | /** Bind a socket to a specific port. |
| nexpaq | 0:6c56fb4bc5f0 | 33 | \param port The port to listen for incoming connections on. |
| nexpaq | 0:6c56fb4bc5f0 | 34 | \return 0 on success, -1 on failure. |
| nexpaq | 0:6c56fb4bc5f0 | 35 | */ |
| nexpaq | 0:6c56fb4bc5f0 | 36 | int bind(int port); |
| nexpaq | 0:6c56fb4bc5f0 | 37 | |
| nexpaq | 0:6c56fb4bc5f0 | 38 | /** Start listening for incoming connections. |
| nexpaq | 0:6c56fb4bc5f0 | 39 | \param backlog number of pending connections that can be queued up at any |
| nexpaq | 0:6c56fb4bc5f0 | 40 | one time [Default: 1]. |
| nexpaq | 0:6c56fb4bc5f0 | 41 | \return 0 on success, -1 on failure. |
| nexpaq | 0:6c56fb4bc5f0 | 42 | */ |
| nexpaq | 0:6c56fb4bc5f0 | 43 | int listen(int backlog=1); |
| nexpaq | 0:6c56fb4bc5f0 | 44 | |
| nexpaq | 0:6c56fb4bc5f0 | 45 | /** Accept a new connection. |
| nexpaq | 0:6c56fb4bc5f0 | 46 | \param connection A TCPSocketConnection instance that will handle the incoming connection. |
| nexpaq | 0:6c56fb4bc5f0 | 47 | \return 0 on success, -1 on failure. |
| nexpaq | 0:6c56fb4bc5f0 | 48 | */ |
| nexpaq | 0:6c56fb4bc5f0 | 49 | int accept(TCPSocketConnection& connection); |
| nexpaq | 0:6c56fb4bc5f0 | 50 | }; |
| nexpaq | 0:6c56fb4bc5f0 | 51 | |
| nexpaq | 0:6c56fb4bc5f0 | 52 | #endif |