Provides UDP functionality to a DDispatcher. DUdpModule uses events to provide notifications, see the Event Handling section for more.
The steps to enable UDP in a DDispatcher are as follows:
The same DUdpModule can provide UDP to multiple DDispatchers. Received UDP messages are automatically sent to the proper DDispatcher based on the sender's port and IP address, as well as a unique code added to the UDP packet by DUdpModule.
DUdpModule constructor. netEngine is a pointer to the DEngine that will generate the module'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.
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.
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.