randolf.ca
1.00
Randolf Richardson's C++ classes
|
An rsocket_group provides a means to associate multiple rsocket objects so that the same operation can be performed on all of them at once. More...
#include <rsocket_group>
Public Member Functions | |
rsocket_group () noexcept | |
Instantiate an rsocket group with no rsocket objects. | |
template<class R , class... Rs> | |
rsocket_group (R r, Rs... rs) noexcept | |
Instantiate an rsocket group with any number of rsocket objects. | |
std::pair< std::vector< rsocket_group_rc >, std::vector< rsocket_group_rc > > | close () |
Close all rsocketss that are in this rsocket_group. | |
void | erase (rsocket *r) |
Remove an rsocket object from the underlying std::set. | |
template<class R , class... Rs> | |
void | insert (R r, Rs... rs) |
Add one or more rsocket objects to the underlying std::set. | |
void | insert (rsocket *r) |
Add one rsocket object to the underlying std::set. | |
std::string | name () noexcept |
Find out what this rsocket_group's name is. | |
void | name (const std::string name) noexcept |
Specify a name for this rsocket_group. | |
std::shared_ptr< rsocket_io > | net_io () noexcept |
Get the combined total of socket I/O statistics from all rsocket objects in this group. | |
std::string | net_io (const char *format, size_t len=0) noexcept |
Get combined total of socket I/O statistics from all rsocket objects in this group as a pre-formatted std::string object. | |
std::pair< std::vector< rsocket_group_rc >, std::vector< rsocket_group_rc > > | send (const char *msg, const size_t len, const int flags=0) |
Send data in the form of a C-string to all rsocket endpoints that are in this rsocket_group. | |
std::pair< std::vector< rsocket_group_rc >, std::vector< rsocket_group_rc > > | send (const std::string msg, const int flags=0) |
Send data in the form of a std::string to all rsocket endpoints that are in this rsocket_group. | |
std::pair< std::vector< rsocket_group_rc >, std::vector< rsocket_group_rc > > | send (const std::vector< char > msg, const int flags=0) |
Send data in the form of a std::vector<char> to all rsocket endpoints that are in this rsocket_group. | |
std::pair< std::vector< rsocket_group_rc >, std::vector< rsocket_group_rc > > | send_asciiz (const char *msg, const int flags=0) |
Send data in the form of an ASCIIZ string to all rsocket endpoints that are in this rsocket_group., including the terminating NULL character. | |
std::pair< std::vector< rsocket_group_rc >, std::vector< rsocket_group_rc > > | send_byte (const char value, const int flags=0) |
Send one byte of data to all rsocket endpoints that are in this rsocket_group. | |
template<typename T > | |
std::pair< std::vector< rsocket_group_rc >, std::vector< rsocket_group_rc > > | send_eol (const int flags=0) |
Send the EoL sequence to all rsocket endpoints that are in this rsocket_group. | |
template<typename T > | |
std::pair< std::vector< rsocket_group_rc >, std::vector< rsocket_group_rc > > | send_struct (const T value, const int flags=0) |
Send one byte of data to all rsocket endpoints that are in this rsocket_group. | |
std::pair< std::vector< rsocket_group_rc >, std::vector< rsocket_group_rc > > | send_uint16_lsb (const uint16_t value, const int flags=0) |
Send one 16-bit unsigned integer of data in LSB (little endian) order to all rsocket endpoints that are in this rsocket_group. | |
std::pair< std::vector< rsocket_group_rc >, std::vector< rsocket_group_rc > > | send_uint16_msb (const uint16_t value, const int flags=0) |
Send one 16-bit integer of data in MSB (big endian) order to all rsocket endpoints that are in this rsocket_group. | |
std::pair< std::vector< rsocket_group_rc >, std::vector< rsocket_group_rc > > | send_uint32_lsb (const uint32_t value, const int flags=0) |
Send one 32-bit unsigned integer of data in LSB (little endian) order to all rsocket endpoints that are in this rsocket_group. | |
std::pair< std::vector< rsocket_group_rc >, std::vector< rsocket_group_rc > > | send_uint32_msb (const uint32_t value, const int flags=0) |
Send one 32-bit unsigned integer of data in MSB (big endian) order to all rsocket endpoints that are in this rsocket_group. | |
std::pair< std::vector< rsocket_group_rc >, std::vector< rsocket_group_rc > > | send_uint64_lsb (const uint64_t value, const int flags=0) |
Send one 64-bit unsigned integer of data in LSB (little endian) order to all rsocket endpoints that are in this rsocket_group. | |
std::pair< std::vector< rsocket_group_rc >, std::vector< rsocket_group_rc > > | send_uint64_msb (const uint64_t value, const int flags=0) |
Send one 64-bit unsigned integer of data in MSB (big endian) order to all rsocket endpoints that are in this rsocket_group. | |
std::pair< std::vector< rsocket_group_rc >, std::vector< rsocket_group_rc > > | sendline (const std::string msg=std::string(), const int flags=0) |
Send data in the form of a std::string to all rsocket endpoints that are in this rsocket_group, with an EoL sequence appended. | |
std::pair< std::vector< rsocket_group_rc >, std::vector< rsocket_group_rc > > | sendz (const char *msg, const int flags=0) |
Send data in the form of an ASCIIZ string to all rsocket endpoints that are in this rsocket_group.. The terminating NULL character won't be transmitted. | |
std::pair< std::vector< rsocket_group_rc >, std::vector< rsocket_group_rc > > | shutdown (const int how=SHUT_RDWR) |
Shut down the underlying sockets in all rsocket objects that are in this rsocket_group, partially or fully. | |
size_t | size () |
Find out how many rsocket entries are in this group. | |
An rsocket_group provides a means to associate multiple rsocket objects so that the same operation can be performed on all of them at once.
The rsocket::accept() and rsocket::accept4() methods can also be configured to automatically assign group membership to new connections, which can be particularly useful for certain types of multi-user systems.
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Close all rsocketss that are in this rsocket_group.
|
inline |
Remove an rsocket object from the underlying std::set.
r | Pointer to instantiated rsocket object |
|
inline |
Add one rsocket object to the underlying std::set.
r | Pointer to instantiated rsocket object |
|
inline |
Add one or more rsocket objects to the underlying std::set.
r | Pointer to instantiated rsocket object |
rs | Variadic arguments (any quantity of instantiated rsocket objects) |
|
inlinenoexcept |
Specify a name for this rsocket_group.
This is an arbitrary name that is entirely optional, and should be regarded as similar to the naming of threads.
name | Name to assign to this rsocket_group |
|
inlinenoexcept |
Find out what this rsocket_group's name is.
|
inlinenoexcept |
Get the combined total of socket I/O statistics from all rsocket objects in this group.
The number of bytes transmitted and received is tracked internally, so that the information can be used later in logging. These statistics are available at all times, but for logging purposes it makes the most sense to copy this information after the rsocket is closed, at which time the final statistics will continue to be available until the rsocket's destructor takes over.
|
inlinenoexcept |
Get combined total of socket I/O statistics from all rsocket objects in this group as a pre-formatted std::string object.
See the rsocket::net_io method for full documentation.
format | Format string |
len | Length of format string (in bytes), or 0 to auto-detect length if format string is an ASCIIZ string |
|
inline |
Send data in the form of a std::string to all rsocket endpoints that are in this rsocket_group.
msg | Data to send |
flags | MSG_DONTROUTE MSG_DONTWAIT MSG_EOR MSG_NOSIGNAL MSG_OOB |
|
inline |
Send data in the form of a std::vector<char> to all rsocket endpoints that are in this rsocket_group.
msg | Data to send |
flags | MSG_DONTROUTE MSG_DONTWAIT MSG_EOR MSG_NOSIGNAL MSG_OOB |
|
inline |
Send data in the form of a C-string to all rsocket endpoints that are in this rsocket_group.
msg | Pointer to data to send |
len | Number of bytes to send |
flags | MSG_DONTROUTE MSG_DONTWAIT MSG_EOR MSG_NOSIGNAL MSG_OOB |
|
inline |
Send data in the form of an ASCIIZ string to all rsocket endpoints that are in this rsocket_group., including the terminating NULL character.
msg | Pointer to data to send |
flags | MSG_DONTROUTE MSG_DONTWAIT MSG_EOR MSG_NOSIGNAL MSG_OOB |
|
inline |
Send one byte of data to all rsocket endpoints that are in this rsocket_group.
value | Data to send |
flags | MSG_DONTROUTE MSG_DONTWAIT MSG_EOR MSG_NOSIGNAL MSG_OOB |
|
inline |
Send the EoL sequence to all rsocket endpoints that are in this rsocket_group.
flags | MSG_DONTROUTE MSG_DONTWAIT MSG_EOR MSG_NOSIGNAL MSG_OOB |
|
inline |
Send one byte of data to all rsocket endpoints that are in this rsocket_group.
value | Data to send |
flags | MSG_DONTROUTE MSG_DONTWAIT MSG_EOR MSG_NOSIGNAL MSG_OOB |
|
inline |
Send one 16-bit unsigned integer of data in LSB (little endian) order to all rsocket endpoints that are in this rsocket_group.
value | Data to send |
flags | MSG_DONTROUTE MSG_DONTWAIT MSG_EOR MSG_NOSIGNAL MSG_OOB |
|
inline |
Send one 16-bit integer of data in MSB (big endian) order to all rsocket endpoints that are in this rsocket_group.
value | Data to send |
flags | MSG_DONTROUTE MSG_DONTWAIT MSG_EOR MSG_NOSIGNAL MSG_OOB |
|
inline |
Send one 32-bit unsigned integer of data in LSB (little endian) order to all rsocket endpoints that are in this rsocket_group.
value | Data to send |
flags | MSG_DONTROUTE MSG_DONTWAIT MSG_EOR MSG_NOSIGNAL MSG_OOB |
|
inline |
Send one 32-bit unsigned integer of data in MSB (big endian) order to all rsocket endpoints that are in this rsocket_group.
value | Data to send |
flags | MSG_DONTROUTE MSG_DONTWAIT MSG_EOR MSG_NOSIGNAL MSG_OOB |
|
inline |
Send one 64-bit unsigned integer of data in LSB (little endian) order to all rsocket endpoints that are in this rsocket_group.
value | Data to send |
flags | MSG_DONTROUTE MSG_DONTWAIT MSG_EOR MSG_NOSIGNAL MSG_OOB |
|
inline |
Send one 64-bit unsigned integer of data in MSB (big endian) order to all rsocket endpoints that are in this rsocket_group.
value | Data to send |
flags | MSG_DONTROUTE MSG_DONTWAIT MSG_EOR MSG_NOSIGNAL MSG_OOB |
|
inline |
Send data in the form of a std::string to all rsocket endpoints that are in this rsocket_group, with an EoL sequence appended.
msg | Data to send |
flags | MSG_DONTROUTE MSG_DONTWAIT MSG_EOR MSG_NOSIGNAL MSG_OOB |
|
inline |
Send data in the form of an ASCIIZ string to all rsocket endpoints that are in this rsocket_group.. The terminating NULL character won't be transmitted.
msg | Pointer to data to send |
flags | MSG_DONTROUTE MSG_DONTWAIT MSG_EOR MSG_NOSIGNAL MSG_OOB |
|
inline |
Shut down the underlying sockets in all rsocket objects that are in this rsocket_group, partially or fully.
SHUT_RD: Further receives will be disallowed SHUT_WR: Further sends will be disallowed (this may cause actions specific to the protocol family of the socket to occur) SHUT_RDWR: Further sends and receives will be disallowed (default)
how | SHUT_RD SHUT_RW SHUT_RDWR |
|
inline |
Find out how many rsocket entries are in this group.