Handshake signal for serial connection between Arduino Uno and Arduino Nano

Currently I am working on a Serial connection between Arduino Uno (controller) and Arduino Nano connected via ethernet cable to control a robot. I have successfully established connection between the 2 boards with all buttons function normally.

However, when connection is lost (cable unplugged), Nano will keep on doing the last command. I want to create a handshake signal between the two to disconnect/stop the signal but dont know where to start. Thank you for your help!!

Program the robot to always return an acknowledgement message, then you will know.

If I understand you correctly, you should send some keep-alive message. If the robot doesn't get that message within some time frame it stops all activity.