Serial monitor: Cmd error, login timeout loop, can't reconnect

Hi

What is this error? How can I handle it, like restart Mega 2560 if get loop in 10 times?
This error happen very often, maybe 10 times/day, normally hardware can reconnect to server, but sometime hardware can not, it get in “Cmd error”, “login timeout” loop and stay disconnecting to server until I restart the Mega. Than I need to write a code to force hardware auto reboot if loop in 10 times. Can I do this?
My system is Mega 2560 + ESP-01 and local server.

Thanks