NamedPipeServerStream.Disconnect 方法

定義

中斷目前的連接。

C#
public void Disconnect ();
C#
[System.Security.SecurityCritical]
public void Disconnect ();
屬性

例外狀況

尚未建立管道連線。

-或-

連接的管道已中斷連接。

-或-

尚未設定管道控制代碼。

管道已關閉。

備註

Disconnect除非管道的傳輸模式設定為 Message ,而且緩衝區大小是在建立 NamedPipeServerStream 物件的建構函式中設定,否則呼叫 方法會封鎖直到讀取所有傳送的字元為止。 在此情況下,不會收到所有訊息。 呼叫 WaitForPipeDrain 會導致伺服器封鎖,直到從管道讀取所有數據為止。

適用於

產品 版本
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1