add a function to reconnect the client to the server