AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
agxNet::SocketSet Class Reference

#include <Socket.h>

+ Inheritance diagram for agxNet::SocketSet:

Public Member Functions

 SocketSet ()
 Creates a socket set of the specified size.
 
bool addSocket (Socket *sock)
 Add a socket to socket set.
 
bool checkSockets (agx::UInt32 timeoutMillis)
 Check sockets from socket set for activity.
 
size_t getMaxSockets () const
 Returns maximal number of sockets the system allows.
 
size_t getNumSockets () const
 Returns number of sockets the socket set currently holds.
 
const SocketRefVector & getSockets () const
 
bool removeSocket (Socket *sock)
 Remove socket from socket set.
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 

Protected Member Functions

virtual ~SocketSet ()
 Destroys the socket set.
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 

Additional Inherited Members

- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

Definition at line 539 of file Socket.h.

Constructor & Destructor Documentation

◆ SocketSet()

agxNet::SocketSet::SocketSet ( )

Creates a socket set of the specified size.

Creates a socket set which can hold the specified number of sockets at maximum.

◆ ~SocketSet()

virtual agxNet::SocketSet::~SocketSet ( )
inlineprotectedvirtual

Destroys the socket set.

Note, that it does not destroy the sockets this set holds references to.

Definition at line 601 of file Socket.h.

Member Function Documentation

◆ addSocket()

bool agxNet::SocketSet::addSocket ( Socket *  sock)

Add a socket to socket set.

Parameters
sock- pointer to the socket object to add.
Returns
false if socket is already added

◆ checkSockets()

bool agxNet::SocketSet::checkSockets ( agx::UInt32  timeoutMillis)

Check sockets from socket set for activity.

This method checks sockets for activities of incoming data ready or remote socket has disconnected. This method sets ready flag for all sockets with activity which can later be checked by Socket::IsReady() method. The ready flag will be cleared by subsequent TCPSocket::Recv() function call.

Parameters
timeoutMillis- maximum number of milliseconds to wait for socket activity to appear. if 0 is specified the function will not wait and will return immediately.
Returns
true if there is at least one socket with activity.
false if there are no any sockets with activities.

◆ getMaxSockets()

size_t agxNet::SocketSet::getMaxSockets ( ) const

Returns maximal number of sockets the system allows.

Returns
maximal number of sockets available in the system.

◆ getNumSockets()

size_t agxNet::SocketSet::getNumSockets ( ) const
inline

Returns number of sockets the socket set currently holds.

Returns
number of sockets the socket set currently holds.

Definition at line 553 of file Socket.h.

◆ getSockets()

const SocketRefVector & agxNet::SocketSet::getSockets ( ) const
inline

Definition at line 593 of file Socket.h.

◆ removeSocket()

bool agxNet::SocketSet::removeSocket ( Socket *  sock)

Remove socket from socket set.

Parameters
sock- pointer to socket object which we want to remove from the set.
Returns
false if socket is not previously added

The documentation for this class was generated from the following file: