add the daemon function, server can run as a daemon. turn file transfer functions into shared methods