SocketOptions.SoTimeout Campo

Definizione

Attenzione

This constant will be removed in the future version. Use Java.Net.SocketOption enum directly instead of this field.

Impostare un timeout per bloccare le operazioni socket:

[Android.Runtime.Register("SO_TIMEOUT")]
[System.Obsolete("This constant will be removed in the future version. Use Java.Net.SocketOption enum directly instead of this field.", true)]
public const Java.Net.SocketOption SoTimeout = 4102;
[<Android.Runtime.Register("SO_TIMEOUT")>]
[<System.Obsolete("This constant will be removed in the future version. Use Java.Net.SocketOption enum directly instead of this field.", true)>]
val mutable SoTimeout : Java.Net.SocketOption

Valore del campo

Value = 4102
Attributi

Commenti

Impostare un timeout per bloccare le operazioni socket:

ServerSocket.accept();
            SocketInputStream.read();
            DatagramSocket.receive();

Per rendere effettiva l'opzione, è necessario impostare l'opzione prima di immettere un'operazione di blocco. Se il timeout scade e l'operazione continuerà a bloccarsi, <viene generato B>java.io.InterruptedIOException</B> . Il socket non è chiuso in questo caso.

Valido per tutti i socket: SocketImpl, DatagramSocketImpl

Documentazione java per java.net.SocketOptions.SO_TIMEOUT.

Le parti di questa pagina sono modifiche basate sul lavoro creato e condiviso dal progetto Open Source Android e usato in base ai termini descritti nella licenza Creative Commons 2.5 Attribuzione.

Si applica a