Async 1.8.0
|
A class for working with UDP sockets. More...
#include <AsyncUdpSocket.h>
Public Member Functions | |
UdpSocket (uint16_t local_port=0, const IpAddress &bind_ip=IpAddress()) | |
Constructor. | |
virtual | ~UdpSocket (void) |
Destructor. | |
virtual bool | initOk (void) const |
Check if the initialization was ok. | |
Async::IpAddress | localAddr (void) const |
Get the local IP address associated with this connection. | |
uint16_t | localPort (void) const |
Get the local UDP port associated with this connection. | |
virtual bool | write (const IpAddress &remote_ip, int remote_port, const void *buf, int count) |
Write data to the remote host. | |
virtual int | fd (void) const |
Get the file descriptor for the UDP socket. | |
Public Attributes | |
sigc::signal< void, const IpAddress &, uint16_t, void *, int > | dataReceived |
A signal that is emitted when data has been received. | |
sigc::signal< void, bool > | sendBufferFull |
A signal that is emitted when the send buffer is full. | |
Protected Member Functions | |
virtual void | onDataReceived (const IpAddress &ip, uint16_t port, void *buf, int count) |
A class for working with UDP sockets.
This class is used to work with UDP sockets. An example usage is shown below.
Definition at line 124 of file AsyncUdpSocket.h.
Constructor.
local_port | The local port to use. If not specified, a random local port will be used. |
bind_ip | Bind to the interface with the given IP address. If left empty, bind to all interfaces. |
|
virtual |
Destructor.
|
inlinevirtual |
Get the file descriptor for the UDP socket.
Definition at line 179 of file AsyncUdpSocket.h.
|
inlinevirtual |
Check if the initialization was ok.
This function should always be called after constructing the object to see if everything went fine.
Reimplemented in Async::EncryptedUdpSocket.
Definition at line 149 of file AsyncUdpSocket.h.
Referenced by Async::EncryptedUdpSocket::initOk().
Async::IpAddress Async::UdpSocket::localAddr | ( | void | ) | const |
Get the local IP address associated with this connection.
uint16_t Async::UdpSocket::localPort | ( | void | ) | const |
Get the local UDP port associated with this connection.
|
protectedvirtual |
Reimplemented in Async::EncryptedUdpSocket.
|
virtual |
Write data to the remote host.
remote_ip | The IP-address of the remote host |
remote_port | The remote port to use |
buf | A buffer containing the data to send |
count | The number of bytes to write |
Reimplemented in Async::EncryptedUdpSocket.
sigc::signal<void, const IpAddress&, uint16_t, void*, int> Async::UdpSocket::dataReceived |
A signal that is emitted when data has been received.
ip | The IP-address the data was received from |
port | The remote port number |
buf | The buffer containing the read data |
count | The number of bytes read |
Definition at line 188 of file AsyncUdpSocket.h.
sigc::signal<void, bool> Async::UdpSocket::sendBufferFull |
A signal that is emitted when the send buffer is full.
is_full | Set to true if the buffer is full or false if the buffer full condition has been cleared |
Definition at line 195 of file AsyncUdpSocket.h.