dhgdh
Dependencies: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
TCPListener Class Reference
TCPListener: a TCP server socket The TCPListener listens for incoming connections. More...
#include <TCPListener.h>
Inherits mbed::Sockets::v0::TCPAsynch, and mbed::Sockets::v0::TCPAsynch.
Public Member Functions | |
| TCPListener (const socket_stack_t stack) | |
| The TCP Listener constructor. | |
| ~TCPListener () | |
| The TCP Listener destructor This performs teardown of the listener. | |
| socket_error_t | start_listening (IncomingHandler_t listenHandler, uint32_t backlog=0) |
| Begin listening for incoming connections. | |
| socket_error_t | stop_listening () |
| Stop listening for incoming connections After this call, the server will reject incoming connections until start_listening is called again. | |
| virtual TCPStream * | accept (void *new_impl) |
| accept is a utility function for constructing a new TCPStream from an incoming connection The event passed to the listenHandler contains a pointer to a low level implementation of an already connected socket. | |
| TCPListener (const socket_stack_t stack) | |
| The TCP Listener constructor. | |
| ~TCPListener () | |
| The TCP Listener destructor This performs teardown of the listener. | |
| socket_error_t | start_listening (IncomingHandler_t listenHandler, uint32_t backlog=0) |
| Begin listening for incoming connections. | |
| socket_error_t | stop_listening () |
| Stop listening for incoming connections After this call, the server will reject incoming connections until start_listening is called again. | |
| virtual TCPStream * | accept (void *new_impl) |
| accept is a utility function for constructing a new TCPStream from an incoming connection The event passed to the listenHandler contains a pointer to a low level implementation of an already connected socket. | |
| virtual socket_error_t | open (const socket_address_family_t af, const socket_proto_family_t pf) |
| Open the socket. | |
| virtual socket_error_t | resolve (const char *address, const DNSHandler_t &onDNS) |
| Start the process of resolving a domain name. | |
| virtual socket_error_t | resolve (const char *address, const DNSHandler_t &onDNS) |
| Start the process of resolving a domain name. | |
| virtual socket_error_t | bind (const char *address, const uint16_t port) |
| Binds the socket's local address and IP. | |
| virtual socket_error_t | bind (const SocketAddr *address, const uint16_t port) |
| bind(const SocketAddr *, const uint16_t) is the same as bind(const char *, const uint16_t), except that the address passed in is a SocketAddr. | |
| virtual socket_error_t | bind (const char *address, const uint16_t port) |
| Binds the socket's local address and IP. | |
| virtual socket_error_t | bind (const SocketAddr *address, const uint16_t port) |
| bind(const SocketAddr *, const uint16_t) is the same as bind(const char *, const uint16_t), except that the address passed in is a SocketAddr. | |
| virtual void | setOnError (const ErrorHandler_t &onError) |
| Set the error handler. | |
| virtual void | setOnError (const ErrorHandler_t &onError) |
| Set the error handler. | |
| virtual void | setOnReadable (const ReadableHandler_t &onReadable) |
| Set the received data handler Received data is queued until it is read using recv or recv_from. | |
| virtual void | setOnReadable (const ReadableHandler_t &onReadable) |
| Set the received data handler Received data is queued until it is read using recv or recv_from. | |
| virtual socket_error_t | recv (void *buf, size_t *len) |
| Receive a message. | |
| virtual socket_error_t | recv (void *buf, size_t *len) |
| Receive a message. | |
| virtual socket_error_t | recv_from (void *buf, size_t *len, SocketAddr *remote_addr, uint16_t *remote_port) |
| Receive a message with the sender address and port This API is not valid for SOCK_STREAM. | |
| virtual socket_error_t | recv_from (void *buf, size_t *len, SocketAddr *remote_addr, uint16_t *remote_port) |
| Receive a message with the sender address and port This API is not valid for SOCK_STREAM. | |
| virtual void | setOnSent (const SentHandler_t &onSent) |
| Set the onSent handler. | |
| virtual void | setOnSent (const SentHandler_t &onSent) |
| Set the onSent handler. | |
| virtual socket_error_t | send (const void *buf, const size_t len) |
| Send a message Sends a message over an open connection. | |
| virtual socket_error_t | send (const void *buf, const size_t len) |
| Send a message Sends a message over an open connection. | |
| virtual socket_error_t | send_to (const void *buf, const size_t len, const SocketAddr *remote_addr, uint16_t remote_port) |
| Send a message to a specific address and port This API is not valid for SOCK_STREAM. | |
| virtual socket_error_t | send_to (const void *buf, const size_t len, const SocketAddr *remote_addr, uint16_t remote_port) |
| Send a message to a specific address and port This API is not valid for SOCK_STREAM. | |
| virtual socket_error_t | close () |
| Shuts down a socket. | |
| virtual socket_error_t | close () |
| Shuts down a socket. | |
| virtual bool | error_check (socket_error_t err) |
| Error checking utility Generates an event on error, does nothing on SOCKET_ERROR_NONE. | |
| virtual bool | error_check (socket_error_t err) |
| Error checking utility Generates an event on error, does nothing on SOCKET_ERROR_NONE. | |
| virtual bool | isConnected () const |
| Checks the socket status to determine whether it is still connected. | |
| virtual bool | isConnected () const |
| Checks the socket status to determine whether it is still connected. | |
| virtual socket_error_t | getLocalAddr (SocketAddr *addr) const |
| Get the local address of the socket if bound. | |
| virtual socket_error_t | getLocalAddr (SocketAddr *addr) const |
| Get the local address of the socket if bound. | |
| virtual socket_error_t | getLocalPort (uint16_t *port) const |
| Get the local port of the socket if bound. | |
| virtual socket_error_t | getLocalPort (uint16_t *port) const |
| Get the local port of the socket if bound. | |
| virtual socket_error_t | getRemoteAddr (SocketAddr *addr) const |
| Get the remote address of the socket if connected. | |
| virtual socket_error_t | getRemoteAddr (SocketAddr *addr) const |
| Get the remote address of the socket if connected. | |
| virtual socket_error_t | getRemotePort (uint16_t *port) const |
| Get the remote port of the socket if connected. | |
| virtual socket_error_t | getRemotePort (uint16_t *port) const |
| Get the remote port of the socket if connected. | |
Protected Member Functions | |
| void | _eventHandler (struct socket_event *ev) |
| Internal event handler. | |
| void | _eventHandler (struct socket_event *ev) |
| Internal event handler. | |
Detailed Description
TCPListener: a TCP server socket The TCPListener listens for incoming connections.
Prior to listening, the TCPListener must be bound to a port and, optionally, an address.
Definition at line 33 of file test/mbedclient/utest/common/sockets/v0/TCPListener.h.
Constructor & Destructor Documentation
| TCPListener | ( | const socket_stack_t | stack ) |
The TCP Listener constructor.
- Parameters:
-
[in] stack the network stack to use
| ~TCPListener | ( | ) |
The TCP Listener destructor This performs teardown of the listener.
| TCPListener | ( | const socket_stack_t | stack ) |
The TCP Listener constructor.
- Parameters:
-
[in] stack the network stack to use
| ~TCPListener | ( | ) |
The TCP Listener destructor This performs teardown of the listener.
Member Function Documentation
| void _eventHandler | ( | struct socket_event * | ev ) | [protected, virtual] |
| void _eventHandler | ( | struct socket_event * | ev ) | [protected, virtual] |
| virtual TCPStream* accept | ( | void * | new_impl ) | [virtual] |
accept is a utility function for constructing a new TCPStream from an incoming connection The event passed to the listenHandler contains a pointer to a low level implementation of an already connected socket.
This function
- Parameters:
-
new_impl
- Returns:
| virtual TCPStream* accept | ( | void * | new_impl ) | [virtual] |
accept is a utility function for constructing a new TCPStream from an incoming connection The event passed to the listenHandler contains a pointer to a low level implementation of an already connected socket.
This function
- Parameters:
-
new_impl
- Returns:
| socket_error_t bind | ( | const char * | address, |
| const uint16_t | port | ||
| ) | [virtual, inherited] |
Binds the socket's local address and IP.
0.0.0.0 is accepted as a local address if only the port is meant to be bound. The behaviour of bind("0.0.0.0",...) is undefined where two or more stacks are in use.
- Parameters:
-
[in] address The string representation of the address to bind [in] port The local port to bind
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
Definition at line 319 of file test/mbedclient/utest/stub/common_stub.cpp.
| socket_error_t bind | ( | const SocketAddr * | address, |
| const uint16_t | port | ||
| ) | [virtual, inherited] |
bind(const SocketAddr *, const uint16_t) is the same as bind(const char *, const uint16_t), except that the address passed in is a SocketAddr.
- Parameters:
-
[in] address The address to bind [in] port The local port to bind
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
Definition at line 323 of file test/mbedclient/utest/stub/common_stub.cpp.
| virtual socket_error_t bind | ( | const char * | address, |
| const uint16_t | port | ||
| ) | [virtual, inherited] |
Binds the socket's local address and IP.
0.0.0.0 is accepted as a local address if only the port is meant to be bound. The behaviour of bind("0.0.0.0",...) is undefined where two or more stacks are in use.
- Parameters:
-
[in] address The string representation of the address to bind [in] port The local port to bind
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
| virtual socket_error_t bind | ( | const SocketAddr * | address, |
| const uint16_t | port | ||
| ) | [virtual, inherited] |
bind(const SocketAddr *, const uint16_t) is the same as bind(const char *, const uint16_t), except that the address passed in is a SocketAddr.
- Parameters:
-
[in] address The address to bind [in] port The local port to bind
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
| socket_error_t close | ( | ) | [virtual, inherited] |
Shuts down a socket.
Sending and receiving are no longer possible after close() is called. The socket is not deallocated on close. A socket must not be reopened, it should be destroyed (either with delete, or by going out of scope) after calling close. Calling open on a closed socket can result in a memory leak.
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
Definition at line 328 of file test/mbedclient/utest/stub/common_stub.cpp.
| virtual socket_error_t close | ( | ) | [virtual, inherited] |
Shuts down a socket.
Sending and receiving are no longer possible after close() is called. The socket is not deallocated on close. A socket must not be reopened, it should be destroyed (either with delete, or by going out of scope) after calling close. Calling open on a closed socket can result in a memory leak.
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
| bool error_check | ( | socket_error_t | err ) | [virtual, inherited] |
Error checking utility Generates an event on error, does nothing on SOCKET_ERROR_NONE.
- Parameters:
-
[in] err the error code to check
- Returns:
- false if err is SOCKET_ERROR_NONE, true otherwise
Definition at line 269 of file test/mbedclient/utest/stub/common_stub.cpp.
| virtual bool error_check | ( | socket_error_t | err ) | [virtual, inherited] |
Error checking utility Generates an event on error, does nothing on SOCKET_ERROR_NONE.
- Parameters:
-
[in] err the error code to check
- Returns:
- false if err is SOCKET_ERROR_NONE, true otherwise
| socket_error_t getLocalAddr | ( | SocketAddr * | addr ) | const [virtual, inherited] |
Get the local address of the socket if bound.
There are several failing conditions for this method: 1. If the socket has not been opened, returns SOCKET_ERROR_NULL_PTR 2. If the socket has not been bound, returns SOCKET_ERROR_NOT_BOUND 3. If addr is NULL, returns SOCKET_ERROR_NULL_PTR
Otherwise, populates the SocketAddr object with the local address
- Parameters:
-
[out] addr a pointer to a SocketAddr object
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure (see description)
Definition at line 294 of file test/mbedclient/utest/stub/common_stub.cpp.
| virtual socket_error_t getLocalAddr | ( | SocketAddr * | addr ) | const [virtual, inherited] |
Get the local address of the socket if bound.
There are several failing conditions for this method: 1. If the socket has not been opened, returns SOCKET_ERROR_NULL_PTR 2. If the socket has not been bound, returns SOCKET_ERROR_NOT_BOUND 3. If addr is NULL, returns SOCKET_ERROR_NULL_PTR
Otherwise, populates the SocketAddr object with the local address
- Parameters:
-
[out] addr a pointer to a SocketAddr object
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure (see description)
| virtual socket_error_t getLocalPort | ( | uint16_t * | port ) | const [virtual, inherited] |
Get the local port of the socket if bound.
There are several failing conditions for this method: 1. If the socket has not been opened, returns SOCKET_ERROR_NULL_PTR 2. If the socket has not been bound, returns SOCKET_ERROR_NOT_BOUND 3. If port is NULL, returns SOCKET_ERROR_NULL_PTR
Otherwise, populates the uint16_t object with the local port
- Parameters:
-
[out] port a pointer to a uint16_t
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure (see description)
| socket_error_t getLocalPort | ( | uint16_t * | port ) | const [virtual, inherited] |
Get the local port of the socket if bound.
There are several failing conditions for this method: 1. If the socket has not been opened, returns SOCKET_ERROR_NULL_PTR 2. If the socket has not been bound, returns SOCKET_ERROR_NOT_BOUND 3. If port is NULL, returns SOCKET_ERROR_NULL_PTR
Otherwise, populates the uint16_t object with the local port
- Parameters:
-
[out] port a pointer to a uint16_t
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure (see description)
Definition at line 299 of file test/mbedclient/utest/stub/common_stub.cpp.
| socket_error_t getRemoteAddr | ( | SocketAddr * | addr ) | const [virtual, inherited] |
Get the remote address of the socket if connected.
There are several failing conditions for this method: 1. If the socket has not been opened, returns SOCKET_ERROR_NULL_PTR 2. If the socket has not been connected, returns SOCKET_ERROR_NO_CONNECTION 3. If addr is NULL, returns SOCKET_ERROR_NULL_PTR
Otherwise, populates the SocketAddr object with the remote address
- Parameters:
-
[out] addr a pointer to a SocketAddr object
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure (see description)
Definition at line 304 of file test/mbedclient/utest/stub/common_stub.cpp.
| virtual socket_error_t getRemoteAddr | ( | SocketAddr * | addr ) | const [virtual, inherited] |
Get the remote address of the socket if connected.
There are several failing conditions for this method: 1. If the socket has not been opened, returns SOCKET_ERROR_NULL_PTR 2. If the socket has not been connected, returns SOCKET_ERROR_NO_CONNECTION 3. If addr is NULL, returns SOCKET_ERROR_NULL_PTR
Otherwise, populates the SocketAddr object with the remote address
- Parameters:
-
[out] addr a pointer to a SocketAddr object
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure (see description)
| virtual socket_error_t getRemotePort | ( | uint16_t * | port ) | const [virtual, inherited] |
Get the remote port of the socket if connected.
There are several failing conditions for this method: 1. If the socket has not been opened, returns SOCKET_ERROR_NULL_PTR 2. If the socket has not been connected, returns SOCKET_ERROR_NO_CONNECTION 3. If port is NULL, returns SOCKET_ERROR_NULL_PTR
Otherwise, populates the uint16_t object with the remote port
- Parameters:
-
[out] port a pointer to a uint16_t
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure (see description)
| socket_error_t getRemotePort | ( | uint16_t * | port ) | const [virtual, inherited] |
Get the remote port of the socket if connected.
There are several failing conditions for this method: 1. If the socket has not been opened, returns SOCKET_ERROR_NULL_PTR 2. If the socket has not been connected, returns SOCKET_ERROR_NO_CONNECTION 3. If port is NULL, returns SOCKET_ERROR_NULL_PTR
Otherwise, populates the uint16_t object with the remote port
- Parameters:
-
[out] port a pointer to a uint16_t
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure (see description)
Definition at line 309 of file test/mbedclient/utest/stub/common_stub.cpp.
| bool isConnected | ( | ) | const [virtual, inherited] |
Checks the socket status to determine whether it is still connected.
- Returns:
- true if the socket is connected, false if it is not
Definition at line 351 of file test/mbedclient/utest/stub/common_stub.cpp.
| virtual bool isConnected | ( | ) | const [virtual, inherited] |
Checks the socket status to determine whether it is still connected.
- Returns:
- true if the socket is connected, false if it is not
| socket_error_t open | ( | const socket_address_family_t | af, |
| const socket_proto_family_t | pf | ||
| ) | [virtual, inherited] |
Open the socket.
Instantiates and initializes the underlying socket. Receive is started immediately after the socket is opened.
- Parameters:
-
[in] af Address family (SOCKET_AF_INET4 or SOCKET_AF_INET6), currently only IPv4 is supported [in] pf Protocol family (SOCKET_DGRAM or SOCKET_STREAM)
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
Definition at line 264 of file test/mbedclient/utest/stub/common_stub.cpp.
| socket_error_t recv | ( | void * | buf, |
| size_t * | len | ||
| ) | [virtual, inherited] |
Receive a message.
- Parameters:
-
[out] buf The buffer to fill [in,out] len A pointer to the size of the receive buffer. Sets the maximum number of bytes to read but is updated with the actual number of bytes copied on success. len is not changed on failure
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
Definition at line 333 of file test/mbedclient/utest/stub/common_stub.cpp.
| virtual socket_error_t recv | ( | void * | buf, |
| size_t * | len | ||
| ) | [virtual, inherited] |
Receive a message.
- Parameters:
-
[out] buf The buffer to fill [in,out] len A pointer to the size of the receive buffer. Sets the maximum number of bytes to read but is updated with the actual number of bytes copied on success. len is not changed on failure
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
| socket_error_t recv_from | ( | void * | buf, |
| size_t * | len, | ||
| SocketAddr * | remote_addr, | ||
| uint16_t * | remote_port | ||
| ) | [virtual, inherited] |
Receive a message with the sender address and port This API is not valid for SOCK_STREAM.
- Parameters:
-
[out] buf The buffer to fill [in,out] len A pointer to the size of the receive buffer. Sets the maximum number of bytes to read but is updated with the actual number of bytes copied on success. len is not changed on failure [out] remote_addr Pointer to an address structure to fill with the sender address [out] remote_port Pointer to a uint16_t to fill with the sender port
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
Definition at line 337 of file test/mbedclient/utest/stub/common_stub.cpp.
| virtual socket_error_t recv_from | ( | void * | buf, |
| size_t * | len, | ||
| SocketAddr * | remote_addr, | ||
| uint16_t * | remote_port | ||
| ) | [virtual, inherited] |
Receive a message with the sender address and port This API is not valid for SOCK_STREAM.
- Parameters:
-
[out] buf The buffer to fill [in,out] len A pointer to the size of the receive buffer. Sets the maximum number of bytes to read but is updated with the actual number of bytes copied on success. len is not changed on failure [out] remote_addr Pointer to an address structure to fill with the sender address [out] remote_port Pointer to a uint16_t to fill with the sender port
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
| socket_error_t resolve | ( | const char * | address, |
| const DNSHandler_t & | onDNS | ||
| ) | [virtual, inherited] |
Start the process of resolving a domain name.
If the input is a text IP address, an event is queued immediately; otherwise, onDNS is queued as soon as DNS is resolved. The socket must have been opened before resolve is called
- Parameters:
-
[in] address The domain name to resolve [in] onDNS The handler to call when the name is resolved
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
Definition at line 314 of file test/mbedclient/utest/stub/common_stub.cpp.
| virtual socket_error_t resolve | ( | const char * | address, |
| const DNSHandler_t & | onDNS | ||
| ) | [virtual, inherited] |
Start the process of resolving a domain name.
If the input is a text IP address, an event is queued immediately; otherwise, onDNS is queued as soon as DNS is resolved. The socket must have been opened before resolve is called
- Parameters:
-
[in] address The domain name to resolve [in] onDNS The handler to call when the name is resolved
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
| socket_error_t send | ( | const void * | buf, |
| const size_t | len | ||
| ) | [virtual, inherited] |
Send a message Sends a message over an open connection.
This call is valid for UDP sockets, provided that connect() has been called.
- Parameters:
-
[in] buf The payload to send [in] len The size of the payload
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
Definition at line 342 of file test/mbedclient/utest/stub/common_stub.cpp.
| virtual socket_error_t send | ( | const void * | buf, |
| const size_t | len | ||
| ) | [virtual, inherited] |
Send a message Sends a message over an open connection.
This call is valid for UDP sockets, provided that connect() has been called.
- Parameters:
-
[in] buf The payload to send [in] len The size of the payload
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
| socket_error_t send_to | ( | const void * | buf, |
| const size_t | len, | ||
| const SocketAddr * | remote_addr, | ||
| uint16_t | remote_port | ||
| ) | [virtual, inherited] |
Send a message to a specific address and port This API is not valid for SOCK_STREAM.
- Parameters:
-
[in] buf The payload to send [in] len The size of the payload [in] address The address to send to [in] port The remote port to send to
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
Definition at line 346 of file test/mbedclient/utest/stub/common_stub.cpp.
| virtual socket_error_t send_to | ( | const void * | buf, |
| const size_t | len, | ||
| const SocketAddr * | remote_addr, | ||
| uint16_t | remote_port | ||
| ) | [virtual, inherited] |
Send a message to a specific address and port This API is not valid for SOCK_STREAM.
- Parameters:
-
[in] buf The payload to send [in] len The size of the payload [in] address The address to send to [in] port The remote port to send to
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
| void setOnError | ( | const ErrorHandler_t & | onError ) | [virtual, inherited] |
Set the error handler.
Errors are ignored if onError is not set.
- Parameters:
-
[in] onError
Definition at line 278 of file test/mbedclient/utest/stub/common_stub.cpp.
| virtual void setOnError | ( | const ErrorHandler_t & | onError ) | [virtual, inherited] |
Set the error handler.
Errors are ignored if onError is not set.
- Parameters:
-
[in] onError
| void setOnReadable | ( | const ReadableHandler_t & | onReadable ) | [virtual, inherited] |
Set the received data handler Received data is queued until it is read using recv or recv_from.
- Parameters:
-
[in] onReadable the handler to use for receive events
Definition at line 282 of file test/mbedclient/utest/stub/common_stub.cpp.
| virtual void setOnReadable | ( | const ReadableHandler_t & | onReadable ) | [virtual, inherited] |
Set the received data handler Received data is queued until it is read using recv or recv_from.
- Parameters:
-
[in] onReadable the handler to use for receive events
| void setOnSent | ( | const SentHandler_t & | onSent ) | [virtual, inherited] |
Set the onSent handler.
The exact moment this handler is called varies from implementation to implementation. On LwIP, onSent is called when the remote host ACK's data in TCP sockets, or when the message enters the network stack in UDP sockets.
- Parameters:
-
[in] onSent The handler to call when a send completes
Definition at line 286 of file test/mbedclient/utest/stub/common_stub.cpp.
| virtual void setOnSent | ( | const SentHandler_t & | onSent ) | [virtual, inherited] |
Set the onSent handler.
The exact moment this handler is called varies from implementation to implementation. On LwIP, onSent is called when the remote host ACK's data in TCP sockets, or when the message enters the network stack in UDP sockets.
- Parameters:
-
[in] onSent The handler to call when a send completes
| socket_error_t start_listening | ( | IncomingHandler_t | listenHandler, |
| uint32_t | backlog = 0 |
||
| ) |
Begin listening for incoming connections.
The supplied listenHandler will be called whenever an incoming connection arrives To reject a connection, the event handler needs to set the reject flag in the event.
- Parameters:
-
[in] listenHandler The event handler to call when an incoming connection arrives [in] backlog The number of connection requests to keep in the backlog
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
| socket_error_t start_listening | ( | IncomingHandler_t | listenHandler, |
| uint32_t | backlog = 0 |
||
| ) |
Begin listening for incoming connections.
The supplied listenHandler will be called whenever an incoming connection arrives To reject a connection, the event handler needs to set the reject flag in the event.
- Parameters:
-
[in] listenHandler The event handler to call when an incoming connection arrives [in] backlog The number of connection requests to keep in the backlog
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
| socket_error_t stop_listening | ( | ) |
Stop listening for incoming connections After this call, the server will reject incoming connections until start_listening is called again.
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
| socket_error_t stop_listening | ( | ) |
Stop listening for incoming connections After this call, the server will reject incoming connections until start_listening is called again.
- Returns:
- SOCKET_ERROR_NONE on success, or an error code on failure
Generated on Tue Jul 12 2022 11:02:16 by
1.7.2
