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.
Dependents: NNN50_CE_Test_UDP NNN50_linux_firmware NNN50_SoftAP_HelloWorld NNN50_BLEWIFISensor ... more
EthernetInterface/Socket/TCPSocketServer.h@28:2abbf8463fa8, 2017-06-29 (annotated)
- Committer:
- tsungta
- Date:
- Thu Jun 29 04:18:26 2017 +0000
- Revision:
- 28:2abbf8463fa8
- Parent:
- 22:5b38592bc0e6
50:c1cdd22; Compiled with mbed-os 5.5.1 using Optimization Level 3; Host driver is upgrade to 19.5.2; Add API setTXPower and setPPAGain; Remove RTOS relative call function to save RAM space
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| tsungta | 22:5b38592bc0e6 | 1 | /* Copyright (C) 2012 mbed.org, MIT License |
| tsungta | 22:5b38592bc0e6 | 2 | * |
| tsungta | 22:5b38592bc0e6 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
| tsungta | 22:5b38592bc0e6 | 4 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
| tsungta | 22:5b38592bc0e6 | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
| tsungta | 22:5b38592bc0e6 | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
| tsungta | 22:5b38592bc0e6 | 7 | * furnished to do so, subject to the following conditions: |
| tsungta | 22:5b38592bc0e6 | 8 | * |
| tsungta | 22:5b38592bc0e6 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
| tsungta | 22:5b38592bc0e6 | 10 | * substantial portions of the Software. |
| tsungta | 22:5b38592bc0e6 | 11 | * |
| tsungta | 22:5b38592bc0e6 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
| tsungta | 22:5b38592bc0e6 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| tsungta | 22:5b38592bc0e6 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
| tsungta | 22:5b38592bc0e6 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| tsungta | 22:5b38592bc0e6 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| tsungta | 22:5b38592bc0e6 | 17 | */ |
| tsungta | 22:5b38592bc0e6 | 18 | #ifndef TCPSOCKETSERVER_H |
| tsungta | 22:5b38592bc0e6 | 19 | #define TCPSOCKETSERVER_H |
| tsungta | 22:5b38592bc0e6 | 20 | |
| tsungta | 22:5b38592bc0e6 | 21 | #include "Socket/Socket.h" |
| tsungta | 22:5b38592bc0e6 | 22 | #include "TCPSocketConnection.h" |
| tsungta | 22:5b38592bc0e6 | 23 | |
| tsungta | 22:5b38592bc0e6 | 24 | /** TCP Server. |
| tsungta | 22:5b38592bc0e6 | 25 | */ |
| tsungta | 22:5b38592bc0e6 | 26 | class TCPSocketServer : public Socket { |
| tsungta | 22:5b38592bc0e6 | 27 | public: |
| tsungta | 22:5b38592bc0e6 | 28 | /** Instantiate a TCP Server. |
| tsungta | 22:5b38592bc0e6 | 29 | */ |
| tsungta | 22:5b38592bc0e6 | 30 | TCPSocketServer(); |
| tsungta | 22:5b38592bc0e6 | 31 | |
| tsungta | 22:5b38592bc0e6 | 32 | /** Bind a socket to a specific port. |
| tsungta | 22:5b38592bc0e6 | 33 | \param port The port to listen for incoming connections on. |
| tsungta | 22:5b38592bc0e6 | 34 | \return 0 on success, -1 on failure. |
| tsungta | 22:5b38592bc0e6 | 35 | */ |
| tsungta | 22:5b38592bc0e6 | 36 | int bind(int port); |
| tsungta | 22:5b38592bc0e6 | 37 | |
| tsungta | 22:5b38592bc0e6 | 38 | /** Start listening for incoming connections. |
| tsungta | 22:5b38592bc0e6 | 39 | \param backlog number of pending connections that can be queued up at any |
| tsungta | 22:5b38592bc0e6 | 40 | one time [Default: 1]. |
| tsungta | 22:5b38592bc0e6 | 41 | \return 0 on success, -1 on failure. |
| tsungta | 22:5b38592bc0e6 | 42 | */ |
| tsungta | 22:5b38592bc0e6 | 43 | int listen(int backlog=1); |
| tsungta | 22:5b38592bc0e6 | 44 | |
| tsungta | 22:5b38592bc0e6 | 45 | /** Accept a new connection. |
| tsungta | 22:5b38592bc0e6 | 46 | \param connection A TCPSocketConnection instance that will handle the incoming connection. |
| tsungta | 22:5b38592bc0e6 | 47 | \return 0 on success, -1 on failure. |
| tsungta | 22:5b38592bc0e6 | 48 | */ |
| tsungta | 22:5b38592bc0e6 | 49 | int accept(TCPSocketConnection& connection); |
| tsungta | 22:5b38592bc0e6 | 50 | }; |
| tsungta | 22:5b38592bc0e6 | 51 | |
| tsungta | 22:5b38592bc0e6 | 52 | #endif |
| tsungta | 22:5b38592bc0e6 | 53 |