raise IOException on socket error