語言

DatagramSocketImpl.InterfaceConsts.SoTimeout 欄位

定義

警告

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

設定阻擋 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

欄位值

Value = 4102
屬性

備註

設定阻擋 Socket 操作的逾時:

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

該選項必須在進入阻擋操作前設定,才能生效。 若逾時期結束且操作仍持續阻塞,則 <會啟動 Java>.io.InterruptedIOException</B> 鍵。 此時套筒並未關閉。

適用於所有套接字:SocketImpl、DatagramSocketImpl

Java 文件 java.net.SocketOptions.SO_TIMEOUT

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於