A wrapper around a Boost UDP socket. DUdpSocket uses events to provide notifications, see the Event Handling section for more.
DUdpSocket constructor. netEngine is a pointer to the DEngine that will generate the socket's events.
Binds the socket to the specified portNumber. IpVersion should be set to DA_IPV4 or DA_IPV6. Returns false if an error occurred and sets errMsg.
Convenience method that removes all user-defined event handlers from this socket. For example, handlers set with setReceiveHandler, setSendHandler, etc.
Closes a socket that was opened with bind(). Returns false on failure and sets errMsg with a description of the problem.
Returns a description of the most recent error for this socket. Returns an empty string if there haven't been any errors yet.
Returns the port to which this socket is bound, or 0 if the socket is not bound to any port.
Given a hostName of the form www.google.com, obtains the associated IP address using DNS. ipVersion can be set to DA_IPV4 or DA_IPV6. resolveHandler will be called when resolveHost finishes, and is given a vector of strings containing the matching IP addresses. If no addresses are returned (vector size is zero), errMsg will be set with a description of the problem.
Sends theData to the specified IP address and port number. The socket must be bound before send can be used. Up to 65507 bytes can be sent at a time.
Set the event handler to be called when an error occurs in an asynchronous operation. The string parameter contains a description of the error. The bool parameter, socketOK, indicates if this was an unrecoverable error and the socket was automatically closed. True means the socket is still open, false means it was closed.
Set the event handler to be called when we've received data on this socket. The DBuffer contains the data, the string is the remote host's IP address, and the uint16_t is the remote host's port number.
Set the event handler to be called when all pending data has been sent.