NamedPipeServerStream.Disconnect 方法

定义

断开当前连接。Disconnects the current connection.

public:
 void Disconnect();
public void Disconnect ();
[System.Security.SecurityCritical]
public void Disconnect ();
member this.Disconnect : unit -> unit
Public Sub Disconnect ()
属性

例外

尚未建立管道连接。No pipe connections have been made yet.

- 或 --or-

连接的管道已断开。The connected pipe has already disconnected.

- 或 --or-

尚未设置管道句柄。The pipe handle has not been set.

管道已关闭。The pipe is closed.

注解

调用 Disconnect 方法将被阻止,直到所有发送的字符都已读取,除非管道的传输模式设置为 Message 并且在创建 NamedPipeServerStream 对象的构造函数中设置了缓冲区大小。Calling the Disconnect method will block until all the sent characters have been read unless the transmission mode of the pipe is set to Message and the buffer size is set in the constructor that created the NamedPipeServerStream object. 在这种情况下,不会接收到所有消息。In this case, not all of the messages will be received. 调用 WaitForPipeDrain 会导致服务器发生阻塞,直到从管道中读取所有数据。Calling WaitForPipeDrain causes the server to block until all the data has been read from the pipe.

适用于