Added support for reconnecting to a network.