|
AGXDynamics
2.31.1.0
|
#include <Socket.h>
Inheritance diagram for agxNet::TCPSocket:Public Member Functions | |
| TCPSocket () | |
| Constructs an invalid TCP socket object. More... | |
| TCPSocket (const TCPSocket &s, const IPAddress &adr=IPAddress()) | |
| A copy constructor. More... | |
| TCPSocket (const IPAddress &ip, bool disableNaggle=false) | |
| A constructor which automatically calls TCPSocket::Open() method. More... | |
| const IPAddress & | adr () const |
| template<typename T > | |
| T * | as () |
| Subclass casting. More... | |
| template<typename T > | |
| const T * | as () const |
| template<typename T > | |
| T * | asSafe () |
| Safe subclass casting, return nullptr if template type does not match. More... | |
| template<typename T > | |
| const T * | asSafe () const |
| void | close () |
| Closes the socket disconnecting it if necessary. More... | |
| int | getReferenceCount () const |
| template<typename T > | |
| bool | is () const |
| Subclass test. More... | |
| bool | isBlocking () const |
| bool | isReady () const |
| Tells whether there is some activity on the socket or not. More... | |
| bool | isValid () const |
| Tells whether the socket is opened or not. More... | |
| void | open (const IPAddress &ip, bool disableNaggle=false) |
| Connects the socket. More... | |
| TCPSocket & | operator= (const TCPSocket &s) |
| Assignment operator, works similar to std::auto_ptr::operator=(). More... | |
| bool | readyToReceive () const |
| bool | readyToSend () const |
| size_t | recv (agx::UInt8 *buf, size_t maxSize) |
| Receive data from connected socket. More... | |
| void | recvBlocking (agx::UInt8 *buf, agx::UInt32 size) |
| void | reference (void *ptr=nullptr) const |
| Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More... | |
| void | select (agx::UInt32 timeoutMillis=0) |
| agx::UInt32 | send (const agx::UInt8 *data, agx::UInt32 size) |
| Send data to connected socket. More... | |
| void | sendBlocking (const agx::UInt8 *data, agx::UInt32 size) |
| void | sendBlocking (const StructuredMessage *message) |
| void | setBlocking (bool flag) |
| void | unreference (void *ptr=nullptr) const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. More... | |
| void | unreference_nodelete () const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. More... | |
Static Public Member Functions | |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Protected Member Functions | |
| void | allocateObserverVector () const |
| void | deleteUsingDeleteHandler () const |
Static Protected Member Functions | |
| static DeleteHandler * | getDeleteHandler () |
| static void | setDeleteHandler (DeleteHandler *handler) |
| Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More... | |
Protected Attributes | |
| IPAddress | m_adr |
| bool | m_blocking |
| Mutex | m_mutex |
| ObserverContainer | m_observers |
| bool | m_readyToReceive |
| bool | m_readyToSend |
| AtomicValue | m_refCount |
| SystemIndependentSocketHandle | m_socket |
|
inline |
A copy constructor.
Copy constructor creates a new socket object which refers to the same socket as s. After constructor completes the s becomes invalid. In other words, the behavior of copy constructor is similar to one of std::auto_ptr class from standard C++ library.
| s | - other TCP socket to make a copy from. |
|
inline |
A constructor which automatically calls TCPSocket::Open() method.
This constructor creates a socket and calls its TCPSocket::Open() method. So, it creates an already opened socket.
| ip | - IP address to 'connect to/listen on'. |
| disableNaggle | - enable/disable Naggle algorithm. |
|
inlineinherited |
|
protectedinherited |
|
inherited |
Subclass casting.
Template type must match actual type, dynamic_cast assertion will fail otherwise.
Referenced by agx::InternalData::get(), agxVehicle::Track::getNode(), and agx::InternalData::getOrCreate().
|
inherited |
|
inherited |
Safe subclass casting, return nullptr if template type does not match.
Referenced by agxUtil::CollectBodiesAndWiresVisitor::visit().
|
inherited |
|
inherited |
Closes the socket disconnecting it if necessary.
|
protectedinherited |
|
staticprotectedinherited |
|
inherited |
|
inherited |
Subclass test.
Referenced by agx::Object::getAutoScopedResource(), agxData::Buffer::getElement(), and agx::Object::getResource().
|
inlineinherited |
Tells whether there is some activity on the socket or not.
See SocketSet class description for more info on how to use this method properly.
|
inherited |
Tells whether the socket is opened or not.
TODO: write some detailed description.
Connects the socket.
This method connects the socket to remote TCP server socket.
| ip | - IP address. |
| disableNaggle | - enable/disable Naggle algorithm. |
Assignment operator, works similar to std::auto_ptr::operator=().
After this assignment operator completes this socket object refers to the socket the s object referred, s become invalid. It works similar to std::auto_ptr::operator=() from standard C++ library.
| s | - socket to assign from. |
Definition at line 357 of file Socket.h.
References agxNet::Socket::operator=().
|
inlineinherited |
| size_t agxNet::TCPSocket::recv | ( | agx::UInt8 * | buf, |
| size_t | maxSize | ||
| ) |
Receive data from connected socket.
Receives data available on the socket. If there is no data available this function blocks until some data arrives.
| buf | - pointer to the buffer where to put received data. |
| maxSize | - maximal number of bytes which can be put to the buffer. |
| void agxNet::TCPSocket::recvBlocking | ( | agx::UInt8 * | buf, |
| agx::UInt32 | size | ||
| ) |
Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
This method should be used with care, always balanced with the same number of calls to unreference.
Referenced by agxData::Val< UInt >::Val().
|
inherited |
| agx::UInt32 agxNet::TCPSocket::send | ( | const agx::UInt8 * | data, |
| agx::UInt32 | size | ||
| ) |
Send data to connected socket.
Sends data on connected socket. This method blocks until all data is completely sent.
| data | - pointer to the buffer with data to send. |
| size | - number of bytes to send. |
| void agxNet::TCPSocket::sendBlocking | ( | const agx::UInt8 * | data, |
| agx::UInt32 | size | ||
| ) |
| void agxNet::TCPSocket::sendBlocking | ( | const StructuredMessage * | message | ) |
|
inherited |
|
staticprotectedinherited |
Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
Decrement the reference count by one, indicating that a pointer to this object is referencing it.
If the reference count goes to zero, it is assumed that this object is no longer referenced and is automatically deleted.
This method should be used with care, always balanced with the same number of calls to reference.
|
inherited |
Decrement the reference count by one, indicating that a pointer to this object is referencing it.
However, do not delete it, even if ref count goes to 0. Warning, unref_nodelete() should only be called if the user knows exactly who will be responsible for, one should prefer unref() over unref_nodelete() as the later can lead to memory leaks.
|
staticinherited |
|
mutableprotectedinherited |
Definition at line 240 of file Referenced.h.
|
mutableprotectedinherited |
Definition at line 239 of file Referenced.h.
|
mutableprotectedinherited |
Definition at line 241 of file Referenced.h.
|
protectedinherited |