#include <netlink/socket_group.h>
List of all members.
Detailed Description
To manage sockets and connections
- Examples:
-
chatClient.cc, chatServer.cc, and webGet.cc.
Constructor & Destructor Documentation
| SocketGroup::SocketGroup |
( |
| ) |
|
Member Function Documentation
| NL_NAMESPACE_USE void SocketGroup::add |
( |
Socket * |
socket | ) |
[inline] |
| Socket * 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 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
| void SocketGroup::remove |
( |
unsigned |
index | ) |
[inline] |
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 SocketGroup::size |
( |
| ) |
const [inline] |
Returns the amount of bytes of data stored in the buffer
- Returns:
- Size of buffer data
Returns the size of the group
- Returns:
- The number of Sockets contained in the SocketGroup
- Examples:
- chatServer.cc, and webGet.cc.
The documentation for this class was generated from the following files: