AGX Dynamics 2.40.1.2
Loading...
Searching...
No Matches
agxNet::UDPSocket Class Reference

#include <Socket.h>

+ Inheritance diagram for agxNet::UDPSocket:

Public Member Functions

 UDPSocket ()
 
void open ()
 
void open (agx::UInt16 port)
 Open the socket.
 
agx::UInt32 recv (agx::UInt8 *buf, agx::UInt16 maxSize, IPAddress &out_SenderIP)
 
size_t send (const agx::UInt8 *buf, agx::UInt16 size, IPAddress destinationIP)
 
- Public Member Functions inherited from agxNet::Socket
const IPAddressadr () const
 
void close ()
 Closes the socket disconnecting it if necessary.
 
bool isBlocking () const
 
bool isReady () const
 Tells whether there is some activity on the socket or not.
 
bool isValid () const
 Tells whether the socket is opened or not.
 
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.
 
 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.
 
Referencedoperator= (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 ~UDPSocket ()
 
- Protected Member Functions inherited from agxNet::Socket
 Socket (const IPAddress &adr=IPAddress())
 
virtual ~Socket ()
 Destructor.
 
Socketoperator= (const Socket &s)
 
- 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 agxNet::Socket
static int getLastError ()
 Returns the last reported error from a system call.
 
- 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 DeleteHandlergetDeleteHandler ()
 
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 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
 

Detailed Description

Definition at line 496 of file Socket.h.

Constructor & Destructor Documentation

◆ UDPSocket()

agxNet::UDPSocket::UDPSocket ( )
inline

Definition at line 498 of file Socket.h.

◆ ~UDPSocket()

virtual agxNet::UDPSocket::~UDPSocket ( )
inlineprotectedvirtual

Definition at line 524 of file Socket.h.

Member Function Documentation

◆ open() [1/2]

void agxNet::UDPSocket::open ( )
inline

Definition at line 513 of file Socket.h.

◆ open() [2/2]

void agxNet::UDPSocket::open ( agx::UInt16  port)

Open the socket.

This method opens the socket, this socket can further be used to send or receive data. After the socket is opened it becomes a valid socket and Socket::IsValid() will return true for such socket. After the socket is closed it becomes invalid. In other words, a valid socket is an opened socket. In case of errors this method throws NetError.

Parameters
port- IP port number on which the socket will listen for incoming datagrams. This is useful for server-side sockets, for client-side sockets use UDPSocket::Open().

◆ recv()

agx::UInt32 agxNet::UDPSocket::recv ( agx::UInt8 buf,
agx::UInt16  maxSize,
IPAddress out_SenderIP 
)

◆ send()

size_t agxNet::UDPSocket::send ( const agx::UInt8 buf,
agx::UInt16  size,
IPAddress  destinationIP 
)

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