Fix socket error & output the errors

Signed-off-by: Aleksi Sapon <QcTechs@gmail.com>
Merge pull request #2190 from DDoSQc/master

Fix socket error & output the errors