|
AGX Dynamics
2.37.2.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... | |
| 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... | |
| size_t | recv (agx::UInt8 *buf, size_t maxSize) |
| Receive data from connected socket. More... | |
| void | recvBlocking (agx::UInt8 *buf, agx::UInt32 size) |
| 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) |
Public Member Functions inherited from agxNet::Socket | |
| const IPAddress & | adr () const |
| void | close () |
| Closes the socket disconnecting it if necessary. 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... | |
| bool | readyToReceive () const |
| bool | readyToSend () const |
| void | select (agx::UInt32 timeoutMillis=0) |
| void | setBlocking (bool flag) |
Public Member Functions inherited from agx::Referenced | |
| Referenced () | |
| Default constructor. More... | |
| Referenced (const Referenced &) | |
| 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 |
| int | getReferenceCount () const |
| template<typename T > | |
| bool | is () const |
| Subclass test. More... | |
| Referenced & | operator= (const Referenced &) |
| Assignment operator. Will increment the number of references to the referenced object. More... | |
| 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 | 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... | |
Additional Inherited Members | |
Static Public Member Functions inherited from agxNet::Socket | |
| static int | getLastError () |
| Returns the last reported error from a system call. More... | |
Static Public Member Functions inherited from agx::Referenced | |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Protected Member Functions inherited from agxNet::Socket | |
| Socket (const IPAddress &adr=IPAddress()) | |
| virtual | ~Socket () |
| Destructor. More... | |
| Socket & | operator= (const Socket &s) |
Protected Member Functions inherited from agx::Referenced | |
| virtual | ~Referenced () |
| Destructor. More... | |
| void | allocateObserverVector () const |
| void | deleteUsingDeleteHandler () const |
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. More... | |
Protected Attributes inherited from agxNet::Socket | |
| IPAddress | m_adr |
| bool | m_blocking |
| bool | m_readyToReceive |
| bool | m_readyToSend |
| SystemIndependentSocketHandle | m_socket |
Protected Attributes inherited from agx::Referenced | |
| Mutex | m_mutex |
| ObserverContainer | m_observers |
| AtomicValue | m_refCount |
|
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. |
| void agxNet::TCPSocket::open | ( | const IPAddress & | ip, |
| bool | disableNaggle = false |
||
| ) |
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 378 of file Socket.h.
References agxNet::Socket::operator=().
| 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 | ||
| ) |
| 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 | ) |