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