NegotiateStream.WriteTimeout Propriedade

Definição

Obtém ou define a quantidade de tempo pela qual uma operação de gravação fica bloqueada aguardando dados.

public:
 virtual property int WriteTimeout { int get(); void set(int value); };
public override int WriteTimeout { get; set; }
member this.WriteTimeout : int with get, set
Public Overrides Property WriteTimeout As Integer

Valor da propriedade

Um Int32 que especifica a quantidade de tempo que será decorrido antes que uma operação de gravação falhe.

Exemplos

O exemplo de código a seguir demonstra a exibição do valor dessa propriedade.

static void DisplayStreamProperties( NegotiateStream^ stream )
{
   Console::WriteLine( L"Can read: {0}", stream->CanRead );
   Console::WriteLine( L"Can write: {0}", stream->CanWrite );
   Console::WriteLine( L"Can seek: {0}", stream->CanSeek );
   try
   {
      
      // If the underlying stream supports it, display the length.
      Console::WriteLine( L"Length: {0}", stream->Length );
   }
   catch ( NotSupportedException^ ) 
   {
      Console::WriteLine( L"Cannot get the length of the underlying stream." );
   }

   if ( stream->CanTimeout )
   {
      Console::WriteLine( L"Read time-out: {0}", stream->ReadTimeout );
      Console::WriteLine( L"Write time-out: {0}", stream->WriteTimeout );
   }
}


 static void DisplayStreamProperties(NegotiateStream stream)
{
     Console.WriteLine("Can read: {0}", stream.CanRead);
     Console.WriteLine("Can write: {0}", stream.CanWrite);
     Console.WriteLine("Can seek: {0}", stream.CanSeek);
     try
     {
         // If the underlying stream supports it, display the length.
         Console.WriteLine("Length: {0}", stream.Length);
     } catch (NotSupportedException)
     {
             Console.WriteLine("Cannot get the length of the underlying stream.");
     }

     if (stream.CanTimeout)
     {
         Console.WriteLine("Read time-out: {0}", stream.ReadTimeout);
         Console.WriteLine("Write time-out: {0}", stream.WriteTimeout);
     }
}

Comentários

Essa propriedade retorna o valor retornado invocando a WriteTimeout propriedade no fluxo subjacente. Para operações de conjunto, o valor especificado define o WriteTimeout valor no fluxo subjacente.

Se o fluxo subjacente for um NetworkStream, WriteTimeout estará em milissegundos e será definido como por padrão para Infinite que as operações de gravação não atingissem o tempo limite.

Aplica-se a