#include <netlink/socket_group.h>
To manage sockets and connections
- Examples:
- chatClient.cc, chatServer.cc, and webGet.cc.
SocketGroup::SocketGroup |
( |
| ) |
|
void NL::SocketGroup::add |
( |
Socket * |
socket | ) |
|
|
inline |
Socket * NL::SocketGroup::get |
( |
unsigned |
index | ) |
const |
|
inline |
bool SocketGroup::listen |
( |
unsigned |
milisec = 0 , |
|
|
void * |
reference = NULL |
|
) |
| |
Listens for incoming data/connections
Listens during milisecs time for incoming data/connections in any socket of the group calling the appropriate callback (Accept, Read or Disconnect) if assigned.
- Note
- UDP sockets only uses Read callback as they don not establish connections (can not accept) nor they register disconnections
- Parameters
-
milisec | minimum time spent listening. By defaul 0 |
reference | A pointer which can be passed to the callback functions so they have a context. By default NULL |
- Returns
- false if there were no incoming data, true otherwise
- Exceptions
-
- Examples:
- chatClient.cc, chatServer.cc, and webGet.cc.
void NL::SocketGroup::remove |
( |
unsigned |
index | ) |
|
|
inline |
void SocketGroup::remove |
( |
Socket * |
socket | ) |
|
Removes a socket of the group
- Parameters
-
socket | The socket we want to be removed |
- Warning
- This removes only one reference to the socket: if the socket was added to the group more than once (you shouldn't) there will be references left
Sets the onAcceptReady callback
This callback will be call for any incoming connection waiting to be accepted
- Parameters
-
cmd | SocketGroupCmd implementing the desired callback in exec() function |
- Warning
- Only used for TCP protocol SERVER sockets
- Examples:
- chatServer.cc.
Sets the onDisconnect callback
This callback will be call for any disconnection detected
- Parameters
-
cmd | SocketGroupCmd implementing the desired callback in exec() function |
- Warning
- Only used for TCP protocol CLIENT sockets
- Examples:
- chatClient.cc, chatServer.cc, and webGet.cc.
size_t NL::SocketGroup::size |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following files: