This isn't quite what you want. I think you just want to call `mySocket.input.close()`. (There is no `close()` on the output side, only `cancel()`, which is the thing you're defining the behavior of right now.) You also want to say something about shutting down the underlying UDP socket and cleaning up related resources.