Rewrite KeepAlive into a function - KeepAliveFunction(ref Socket client)