Adding a error handler for socket connection to server.