Use a SocketDescriptor as a Server (example TCP or UDP Socket Server). More...
#include <SocketDescriptor.h>
Public Member Functions | |
SocketServer (SocketDescriptor &socket) | |
Build a SocketServer from a SocketDescriptor (already created with SocketDescriptor::create) More... | |
Result | close () |
Calls SocketDescriptor::close. More... | |
Result | bind (SocketIPAddress nativeAddress) |
Binds this socket to a given address / port combination. More... | |
Result | listen (uint32_t numberOfWaitingConnections) |
Start listening for incoming connections at a specific address / port combination (after bind) More... | |
Result | accept (SocketFlags::AddressFamily addressFamily, SocketDescriptor &newClient) |
Accepts a new client, blocking while waiting for it. More... | |
Use a SocketDescriptor as a Server (example TCP or UDP Socket Server).
Example:
|
inline |
Build a SocketServer from a SocketDescriptor (already created with SocketDescriptor::create)
socket | A socket descriptor created with SocketDescriptor::create to be used as server |
Result SC::SocketServer::accept | ( | SocketFlags::AddressFamily | addressFamily, |
SocketDescriptor & | newClient | ||
) |
Accepts a new client, blocking while waiting for it.
[in] | addressFamily | The address family of the SocketDescriptor that will be created |
[out] | newClient | The SocketDescriptor that will be accepted |
Result SC::SocketServer::bind | ( | SocketIPAddress | nativeAddress | ) |
Binds this socket to a given address / port combination.
nativeAddress | The interface ip address and port to start listening to |
Result SC::SocketServer::close | ( | ) |
Calls SocketDescriptor::close.
Start listening for incoming connections at a specific address / port combination (after bind)
numberOfWaitingConnections | How many connections can be queued before accept |