handeling IOException outside of sendToServer now. So that we can have
different behaviour when handeling this in the GUI instead of the CLI
version.