Added another xpcall to handle socket errors.