socket non-blocking handling + apple stuff