improved socket error handling on poll()