Move socket error interpretation to utils.h.