Handle and inform about socket errors in agent