共用方式為


ServicePoint.UseNagleAlgorithm 屬性

定義

取得或設定 Boolean 值,這個值會決定 Nagle 演算法是否用於這個 ServicePoint 物件所管理的連接。

public:
 property bool UseNagleAlgorithm { bool get(); void set(bool value); };
public bool UseNagleAlgorithm { get; set; }
member this.UseNagleAlgorithm : bool with get, set
Public Property UseNagleAlgorithm As Boolean

屬性值

true 使用 Nagle 演算法;否則,false。 預設值為 true

範例

下列程式代碼範例會顯示這個屬性的值。

Console::WriteLine( "UseNagleAlgorithm = {0} ", sp->UseNagleAlgorithm.ToString() );
Console::WriteLine( "Expect 100-continue = {0}", sp->Expect100Continue.ToString() );
Console.WriteLine("UseNagleAlgorithm = " + sp.UseNagleAlgorithm.ToString());
Console.WriteLine("Expect 100-continue = " + sp.Expect100Continue.ToString());

Console.WriteLine("UseNagleAlgorithm = " + sp.UseNagleAlgorithm.ToString())
Console.WriteLine("Expect 100-continue = " + sp.Expect100Continue.ToString())

備註

謹慎

WebRequestHttpWebRequestServicePointWebClient 已經過時,您不應該將它們用於新的開發。 請改用 HttpClient

Nagle 演算法可用來緩衝小封包的數據,並以單一封包的形式傳輸。 此程式稱為「擷取」,被廣泛使用,因為它會減少傳輸的封包數目,並降低每個封包的額外負荷。

變更這個屬性的值不會影響現有的連接。 只有變更之後建立的新連線才會受到影響。

Nagle 演算法會在 IETF RFC 896 中完整描述。

適用於