Adds datagram event handler and utility functions