Read IO flags first before setting channel to non-blocking