NegotiateStream.WriteTimeout Propiedad

Definición

Obtiene o establece el período de tiempo que se bloquea una operación de escritura mientras espera datos.

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 de propiedad

Int32 que especifica la cantidad de tiempo que pasará antes de que falle una operación de escritura.

Ejemplos

En el ejemplo de código siguiente se muestra el valor de esta propiedad.

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);
     }
}

Comentarios

Esta propiedad devuelve el valor devuelto invocando la WriteTimeout propiedad en la secuencia subyacente. Para las operaciones set, el valor especificado establece el WriteTimeout valor en la secuencia subyacente.

Si la secuencia subyacente es , NetworkStreamWriteTimeout se encuentra en milisegundos y se establece Infinite en de forma predeterminada para que las operaciones de escritura no agoten el tiempo de espera.

Se aplica a