Implementation of the WifiPlusClick hardware module.
Dependents: WifiPlusKlickExample
TCPSocketServer Class Reference
Class TCPSocketServer inherits from class Socket. More...
#include <TCPSocketServer.h>
Inherits Socket.
Public Member Functions | |
TCPSocketServer () | |
Public constructor to instantiate an object of TCPSocketServer. | |
int | bind (int port) |
Bind function to bind the TCPSocketServer to a specific local port as a precondition to listen to new connection requests. | |
int | listen (int backlog=1) |
Listen function allows a bound socket to listen for incoming connections. | |
int | accept (TCPSocketConnection &connection) |
Accept function will be used on a bound and listening socket. | |
void | set_blocking (bool blocking, unsigned int timeout=1500) |
Function set_blocking sets the socket into a blocking or non-blocking status. | |
int | set_option (int level, int optname, const void *optval, int socklen) |
Function set_option is not working as expected, because there this functionality is not supported by the WifiPlusClick module. | |
int | close (bool shutdown=true) |
Function close will close the socket. |
Detailed Description
Class TCPSocketServer inherits from class Socket.
Implements the TCP server socket which is used to listen for a new incoming connection. This implementation can have a backlog of up to 8 sockets. Please note that the number of listening sockets depends on how the WifiPlusClick Module has been configured.
Definition at line 28 of file TCPSocketServer.h.
Constructor & Destructor Documentation
TCPSocketServer | ( | ) |
Public constructor to instantiate an object of TCPSocketServer.
Definition at line 21 of file TCPSocketServer.cpp.
Member Function Documentation
int accept | ( | TCPSocketConnection & | connection ) |
Accept function will be used on a bound and listening socket.
Function will return if a socket connection has been made or a timeout occured.
- Parameters:
-
connection : A reference to a TCCPSocketConnection object which will be a valid client socket if a connection has been made.
- Returns:
- : 0 if successfull, or -1 on failure.
Definition at line 55 of file TCPSocketServer.cpp.
int bind | ( | int | port ) |
Bind function to bind the TCPSocketServer to a specific local port as a precondition to listen to new connection requests.
- Parameters:
-
port : local port to which the server socket shall be bound.
- Returns:
- : 0 if successfull, or -1 on failure.
Definition at line 26 of file TCPSocketServer.cpp.
int close | ( | bool | shutdown = true ) |
[inherited] |
Function close will close the socket.
- Parameters:
-
shutdown : This parameter will actually be ignored by the implementation.
- Returns:
- : -1 if not successfull >=0 if successfull
Definition at line 38 of file Socket.cpp.
int listen | ( | int | backlog = 1 ) |
Listen function allows a bound socket to listen for incoming connections.
The number of connectable socket objects can be specified.
- Note:
- : the number of sockets is a configurable resource on WifiPlusClick modules. Use the configuration function Wifi::SocketAllocate to specify the number of sockets to allocate.
- Parameters:
-
backlog : number of sockets which are connectable in the listen state.
- Returns:
- : the new backlog number, or -1 on failure
Definition at line 42 of file TCPSocketServer.cpp.
void set_blocking | ( | bool | blocking, |
unsigned int | timeout = 1500 |
||
) | [inherited] |
Function set_blocking sets the socket into a blocking or non-blocking status.
In case of a blocking socket a timeout can be specified.
- Parameters:
-
blocking : set to true if time consuming socket operations shall block execution until they are finished or until a timeout occurs. If set to false, socket operations will terminated immediately. timeout : a timeout value in milliseconds for use in blocking operations.
Definition at line 31 of file Socket.cpp.
int set_option | ( | int | level, |
int | optname, | ||
const void * | optval, | ||
int | socklen | ||
) | [inherited] |
Function set_option is not working as expected, because there this functionality is not supported by the WifiPlusClick module.
- Note:
- This functionality is just kept for compatibility reasons.
Generated on Tue Jul 12 2022 23:18:35 by 1.7.2