private void sendMsg(String msg) {
        if(socket != null && socket.isConnected()) {
            try {
                DataOutputStream out = new DataOutputStream(socket.getOutputStream());

                if (!msg.endsWith("\n"))
                    msg += "\n";

                out.writeBytes(msg);
                System.err.print("[DEBUG]   Sending: " + msg);
            } catch (IOException e) {
                System.err.println(System.currentTimeMillis() + " [ERROR]   Connection to server failed!");
            }
        } else {
            System.err.println(System.currentTimeMillis() + " [SEVERE]  Could not send message, connection failed");
        }
    }