Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
Tradução
Original
Este tópico ainda não foi avaliado como - Avalie este tópico

TcpClient.ReceiveTimeout Propriedade

Gets or sets the amount of time a TcpClient will wait to receive data once a read operation is initiated.

Namespace:  System.Net.Sockets
Assembly:  System (em System. dll)
public int ReceiveTimeout { get; set; }

Valor da propriedade

Tipo: System.Int32
O valor do tempo limite da conexão em milissegundos.O valor padrão é 0.

The ReceiveTimeout property determines the amount of time that the Read method will block until it is able to receive data.Esse tempo é medido em milissegundos.If the time-out expires before Read successfully completes, TcpClient throws a IOException.Não é nenhum tempo limite por padrão.

Windows Mobile para Pocket PC, Windows Mobile para Smartphone, O Windows CE Platform Note:

In .NET Compact Framework applications, the ReceiveTimeout enumeration value is supported but reserved for future use.Because the ReceiveTimeout property uses this enumeration value, it will raise SocketException until the enumeration value is available in a future release of the .NET Compact Framework.

O exemplo de código a seguir define e obtém o tempo limite de Receber.

// Sets the receive time out using the ReceiveTimeout public property.
tcpClient.ReceiveTimeout = 5000;

// Gets the receive time out using the ReceiveTimeout public property.
if (tcpClient.ReceiveTimeout == 5000)
    Console.WriteLine ("The receive time out limit was successfully set " + tcpClient.ReceiveTimeout.ToString ());



// Sets the receive time out using the ReceiveTimeout public property.
tcpClient.set_ReceiveTimeout(5);

// Gets the receive time out using the ReceiveTimeout public property.
if (tcpClient.get_ReceiveTimeout() == 5) {
    Console.WriteLine("The receive time out limit was successfully set "
        + ((Int32)tcpClient.get_ReceiveTimeout()).ToString());
}


Isso foi útil para você?
(1500 caracteres restantes)

Contribuições da comunidade

ADICIONAR
© 2013 Microsoft. Todos os direitos reservados.