trying to restructure this in a more logical way. I will basically
create an event loop using return values for successful communication,
and exceptions to trigger failure. Catching the failure will result in
an exception handler being called, which will probably have some sort
of function to send an error datagram back, and then either recover
from the error or abort the transmission.