added reconnecting to command feature for reconnecting sockets.