Check handle before setting socket options.