Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
|
#include <CConnectorSocket.hpp>
Public Member Functions | |
CConnectorSocket ()=default | |
CConnectorSocket (const CConnectorSocket &)=delete | |
CConnectorSocket & | operator= (const CConnectorSocket &)=delete |
CConnectorSocket (const CSocketAddress &address) | |
CConnectorSocket (CConnectorSocket &&conn) noexcept | |
CConnectorSocket & | operator= (CConnectorSocket &&rhs) noexcept |
bool | connect (const CSocketAddress &address, int32_t milliseconds=defaultConnectionTimeoutMs) |
bool | isConnected () const |
ssize_t | read (const std::vector< iovec > &ranges) |
virtual ssize_t | read (void *buf, size_t n) |
virtual ssize_t | read_n (void *buf, size_t n) |
virtual ssize_t | write (const std::string &s) |
virtual ssize_t | write (const std::vector< iovec > &ranges) |
virtual ssize_t | write (const void *buf, size_t n) |
virtual ssize_t | write_n (const void *buf, size_t n) |
virtual bool | setReadTimeout (const std::chrono::microseconds &to) |
template<class Rep , class Period > | |
bool | setReadTimeout (const std::chrono::duration< Rep, Period > &to) |
virtual bool | setWriteTimeout (const std::chrono::microseconds &to) |
template<class Rep , class Period > | |
bool | write_timeout (const std::chrono::duration< Rep, Period > &to) |
bool | operator! () const |
Operador de negación. | |
operator bool () const | |
Operador de conversión a bool. | |
virtual bool | bind (const CSocketAddress &address) |
Asigna una dirección a un socket. | |
bool | bind (const sockaddr *address, socklen_t len) const |
bool | isOpen () const |
Comprueba que el handle del socket sea válido. | |
socket_t | release () |
Pone a -1 el handle interno y devuelve el valor anterior. Al no invalidar el file descriptor del socket, se puede usar para desasociar el socket del Sistema Operativo de un objeto CSocket concreto. | |
void | reset (socket_t handle=INVALID_SOCKET) |
Asigna un nuevo handle al socket e invalida el anterior. | |
CSocket | clone () const |
Crea un nuevo objeto CSocket con el mismo handle que el actual. | |
bool | close () |
Cierra el socket. | |
virtual CSocketAddressAny | getAddress () const |
virtual CSocketAddressAny | getPeerAddress () const |
virtual sa_family_t | getFamily () const |
socket_t | getHandle () const |
void | setLastError (int32_t err=INT32_MAX) const |
std::string | getLastErrorString () const |
void | clearLastError (int32_t value=0) const |
bool | getOption (int32_t level, int32_t optName, void *optVal, socklen_t *optLength) const |
template<typename T > | |
bool | getOption (const int32_t level, const int32_t optName, T *value) const |
bool | setOption (int32_t level, int32_t optName, const void *optVal, socklen_t optLength) const |
template<typename T > | |
bool | setOption (const int32_t level, const int32_t optName, const T &value) |
bool | setNonBlocking (bool on=true) const |
Static Public Member Functions | |
static CStreamSocket | create (int32_t domain, int32_t protocol=0) |
static CSocket | create (int32_t domain, int32_t type, int32_t protocol=0) |
static bool | close (socket_t h) |
static std::tuple< CSocket, CSocket > | pair (int32_t domain, int32_t type, int32_t protocol=0) |
Static Public Attributes | |
static constexpr int32_t | COMM_TYPE = SOCK_STREAM |
Protected Member Functions | |
template<typename T > | |
T | checkRet (T ret) const |
template<typename T > | |
bool | checkRetBool (T ret) const |
socket_t | checkSocket (socket_t ret) const |
bool | checkSocketBool (socket_t ret) const |
bool | closeOnError () |
Static Protected Member Functions | |
static socket_t | createHandle (int32_t domain) |
static int32_t | getErrno () |
Función que devuelve el valor actual de errno. | |
Protected Attributes | |
socket_t | m_handle |
Private Member Functions | |
bool | prv_setTimeOut (socket_t fd, int32_t milliseconds) |
Private Attributes | |
int32_t | m_lastError |
Static Private Attributes | |
static constexpr int32_t | defaultConnectionTimeoutMs = 1000 |
|
default |
|
delete |
|
inlineexplicit |
|
inlinenoexcept |
|
virtualinherited |
Asigna una dirección a un socket.
address | Dirección a la que el socket se va a asociar. |
|
inherited |
|
inlineprotectedinherited |
|
inlineprotectedinherited |
|
inlineprotectedinherited |
|
inherited |
|
inherited |
|
inherited |
Cierra el socket.
|
staticinherited |
|
inlineprotectedinherited |
bool CConnectorSocket::connect | ( | const CSocketAddress & | address, |
int32_t | milliseconds = defaultConnectionTimeoutMs ) |
|
staticinherited |
|
staticinherited |
|
inlinestaticprotectedinherited |
|
virtualinherited |
|
staticprotectedinherited |
Función que devuelve el valor actual de errno.
|
virtualinherited |
|
inherited |
|
inherited |
|
inlineinherited |
|
inherited |
|
virtualinherited |
|
inline |
|
inherited |
Comprueba que el handle del socket sea válido.
|
explicitinherited |
Operador de conversión a bool.
|
inherited |
Operador de negación.
|
inlinenoexcept |
|
delete |
|
staticinherited |
|
private |
|
inherited |
|
virtualinherited |
|
virtualinherited |
|
inherited |
Pone a -1 el handle interno y devuelve el valor anterior. Al no invalidar el file descriptor del socket, se puede usar para desasociar el socket del Sistema Operativo de un objeto CSocket concreto.
|
inherited |
Asigna un nuevo handle al socket e invalida el anterior.
handle | Nuevo handle a asignar. |
|
inherited |
|
inherited |
|
inlineinherited |
|
inherited |
|
inlineinherited |
|
virtualinherited |
|
virtualinherited |
|
inlinevirtualinherited |
|
virtualinherited |
|
virtualinherited |
|
virtualinherited |
|
inlineinherited |
|
staticconstexprinherited |
|
staticconstexprprivate |
|
protectedinherited |
|
mutableprivateinherited |