NamedPipeServerStream 构造函数

定义

初始化 NamedPipeServerStream 类的新实例。Initializes a new instance of the NamedPipeServerStream class.

重载

NamedPipeServerStream(String)

用指定的管道名称初始化 NamedPipeServerStream 类的新实例。Initializes a new instance of the NamedPipeServerStream class with the specified pipe name.

NamedPipeServerStream(String, PipeDirection, Int32, PipeTransmissionMode, PipeOptions, Int32, Int32, PipeSecurity, HandleInheritability)

使用指定的管道名称、管道方向、最大数量的服务器实例、传输模式、管道选项、建议的输入输出缓冲区大小、管道安全性和继承模式初始化 NamedPipeServerStream 类的新实例。Initializes a new instance of the NamedPipeServerStream class with the specified pipe name, pipe direction, maximum number of server instances, transmission mode, pipe options, recommended in and out buffer sizes, pipe security, and inheritability mode.

NamedPipeServerStream(String, PipeDirection, Int32, PipeTransmissionMode, PipeOptions, Int32, Int32, PipeSecurity)

使用指定的管道名称、管道方向、最大数量的服务器实例、传输模式、管道选项、建议的输入输出缓冲区大小和管道安全性初始化 NamedPipeServerStream 类的新实例。Initializes a new instance of the NamedPipeServerStream class with the specified pipe name, pipe direction, maximum number of server instances, transmission mode, pipe options, recommended in and out buffer sizes, and pipe security.

NamedPipeServerStream(String, PipeDirection, Int32, PipeTransmissionMode, PipeOptions, Int32, Int32)

使用指定的管道名称、管道方向、最大数量的服务器实例、传输模式、管道选项和建议的输入输出缓冲区大小初始化 NamedPipeServerStream 类的新实例。Initializes a new instance of the NamedPipeServerStream class with the specified pipe name, pipe direction, maximum number of server instances, transmission mode, pipe options, and recommended in and out buffer sizes.

NamedPipeServerStream(String, PipeDirection, Int32, PipeTransmissionMode, PipeOptions)

使用指定的管道名称、管道方向、最大数量的服务器实例、传输模式和管道选项初始化 NamedPipeServerStream 类的新实例。Initializes a new instance of the NamedPipeServerStream class with the specified pipe name, pipe direction, maximum number of server instances, transmission mode, and pipe options.

NamedPipeServerStream(String, PipeDirection, Int32, PipeTransmissionMode, PipeOptions, Int32, Int32, PipeSecurity, HandleInheritability, PipeAccessRights)

使用指定的管道名称、管道方向、最大数量的服务器实例、传输模式、管道选项、建议的输入输出缓冲区大小、管道安全性、继承模式和管道访问权限初始化 NamedPipeServerStream 类的新实例。Initializes a new instance of the NamedPipeServerStream class with the specified pipe name, pipe direction, maximum number of server instances, transmission mode, pipe options, recommended in and out buffer sizes, pipe security, inheritability mode, and pipe access rights.

NamedPipeServerStream(PipeDirection, Boolean, Boolean, SafePipeHandle)

从指定的管道句柄初始化 NamedPipeServerStream 类的一个新实例。Initializes a new instance of the NamedPipeServerStream class from the specified pipe handle.

NamedPipeServerStream(String, PipeDirection, Int32)

使用指定的管道名称、管道方向和最大数量的服务器实例初始化 NamedPipeServerStream 类的一个新实例。Initializes a new instance of the NamedPipeServerStream class with the specified pipe name, pipe direction, and maximum number of server instances.

NamedPipeServerStream(String, PipeDirection)

使用指定的管道名称和管道方向初始化 NamedPipeServerStream 类的新实例。Initializes a new instance of the NamedPipeServerStream class with the specified pipe name and pipe direction.

NamedPipeServerStream(String, PipeDirection, Int32, PipeTransmissionMode)

使用指定的管道名称、管道方向、最大数量的服务器实例和传输模式初始化 NamedPipeServerStream 类的新实例。Initializes a new instance of the NamedPipeServerStream class with the specified pipe name, pipe direction, maximum number of server instances, and transmission mode.

NamedPipeServerStream(String)

用指定的管道名称初始化 NamedPipeServerStream 类的新实例。Initializes a new instance of the NamedPipeServerStream class with the specified pipe name.

public:
 NamedPipeServerStream(System::String ^ pipeName);
public NamedPipeServerStream (string pipeName);
new System.IO.Pipes.NamedPipeServerStream : string -> System.IO.Pipes.NamedPipeServerStream
Public Sub New (pipeName As String)

参数

pipeName
String

管道的名称。The name of the pipe.

例外

pipeNamenullpipeName is null.

pipeName 是一个长度为零的字符串。pipeName is a zero-length string.

pipeName 设置为“匿名”。pipeName is set to "anonymous".

pipeName 包含一个冒号 (":")。pipeName contains a colon (":").

操作系统是不受支持的 Windows Millennium Edition、Windows 98 或 Windows 95。The operating system is Windows Millennium Edition, Windows 98, or Windows 95, which are not supported.

已超出服务器实例的最大数量。The maximum number of server instances has been exceeded.

注解

此构造函数将创建一个具有以下特征的 NamedPipeServerStream 对象:This constructor creates a NamedPipeServerStream object that has the following characteristics:

NamedPipeServerStream(String, PipeDirection, Int32, PipeTransmissionMode, PipeOptions, Int32, Int32, PipeSecurity, HandleInheritability)

使用指定的管道名称、管道方向、最大数量的服务器实例、传输模式、管道选项、建议的输入输出缓冲区大小、管道安全性和继承模式初始化 NamedPipeServerStream 类的新实例。Initializes a new instance of the NamedPipeServerStream class with the specified pipe name, pipe direction, maximum number of server instances, transmission mode, pipe options, recommended in and out buffer sizes, pipe security, and inheritability mode.

public:
 NamedPipeServerStream(System::String ^ pipeName, System::IO::Pipes::PipeDirection direction, int maxNumberOfServerInstances, System::IO::Pipes::PipeTransmissionMode transmissionMode, System::IO::Pipes::PipeOptions options, int inBufferSize, int outBufferSize, System::IO::Pipes::PipeSecurity ^ pipeSecurity, System::IO::HandleInheritability inheritability);
public NamedPipeServerStream (string pipeName, System.IO.Pipes.PipeDirection direction, int maxNumberOfServerInstances, System.IO.Pipes.PipeTransmissionMode transmissionMode, System.IO.Pipes.PipeOptions options, int inBufferSize, int outBufferSize, System.IO.Pipes.PipeSecurity pipeSecurity, System.IO.HandleInheritability inheritability);
new System.IO.Pipes.NamedPipeServerStream : string * System.IO.Pipes.PipeDirection * int * System.IO.Pipes.PipeTransmissionMode * System.IO.Pipes.PipeOptions * int * int * System.IO.Pipes.PipeSecurity * System.IO.HandleInheritability -> System.IO.Pipes.NamedPipeServerStream
Public Sub New (pipeName As String, direction As PipeDirection, maxNumberOfServerInstances As Integer, transmissionMode As PipeTransmissionMode, options As PipeOptions, inBufferSize As Integer, outBufferSize As Integer, pipeSecurity As PipeSecurity, inheritability As HandleInheritability)

参数

pipeName
String

管道的名称。The name of the pipe.

direction
PipeDirection

确定管道方向的枚举值之一。One of the enumeration values that determines the direction of the pipe.

maxNumberOfServerInstances
Int32

共享同一名称的服务器实例的最大数量。The maximum number of server instances that share the same name. 可以为此值传递 MaxAllowedServerInstancesYou can pass MaxAllowedServerInstances for this value.

transmissionMode
PipeTransmissionMode

确定管道传输模式的枚举值之一。One of the enumeration values that determines the transmission mode of the pipe.

options
PipeOptions

确定如何打开或创建管道的枚举值之一。One of the enumeration values that determines how to open or create the pipe.

inBufferSize
Int32

一个大于 0 的正值,指示输入缓冲区大小。A positive value greater than 0 that indicates the input buffer size.

outBufferSize
Int32

一个大于 0 的正值,指示输出缓冲区大小。A positive value greater than 0 that indicates the output buffer size.

pipeSecurity
PipeSecurity

一个对象,确定管道的访问控制和审核安全性。An object that determines the access control and audit security for the pipe.

inheritability
HandleInheritability

确定基础句柄能否由子进程继承的枚举值之一。One of the enumeration values that determines whether the underlying handle can be inherited by child processes.

例外

pipeNamenullpipeName is null.

pipeName 是一个长度为零的字符串。pipeName is a zero-length string.

pipeName 设置为“匿名”。pipeName is set to "anonymous".

- 或 --or- direction 不是有效的 PipeDirection 值。direction is not a valid PipeDirection value.

- 或 --or- maxNumberofServerInstances 小于 -1 或大于 254(-1 指示 MaxAllowedServerInstancesmaxNumberofServerInstances is less than -1 or greater than 254 (-1 indicates MaxAllowedServerInstances) - 或 --or- options 不是有效的 PipeOptions 值。options is not a valid PipeOptions value.

- 或 --or- inBufferSize 为负数。inBufferSize is negative.

- 或 --or- inheritability 不是有效的 HandleInheritability 值。inheritability is not a valid HandleInheritability value.

pipeName 包含一个冒号 (":")。pipeName contains a colon (":").

操作系统是不受支持的 Windows Millennium Edition、Windows 98 或 Windows 95。The operating system is Windows Millennium Edition, Windows 98, or Windows 95, which are not supported.

已超出服务器实例的最大数量。The maximum number of server instances has been exceeded.

注解

此构造函数创建一个没有指定其他 PipeAccessRightsNamedPipeServerStream 对象。This constructor creates a NamedPipeServerStream object that has no specified additional PipeAccessRights.

NamedPipeServerStream(String, PipeDirection, Int32, PipeTransmissionMode, PipeOptions, Int32, Int32, PipeSecurity)

使用指定的管道名称、管道方向、最大数量的服务器实例、传输模式、管道选项、建议的输入输出缓冲区大小和管道安全性初始化 NamedPipeServerStream 类的新实例。Initializes a new instance of the NamedPipeServerStream class with the specified pipe name, pipe direction, maximum number of server instances, transmission mode, pipe options, recommended in and out buffer sizes, and pipe security.

public:
 NamedPipeServerStream(System::String ^ pipeName, System::IO::Pipes::PipeDirection direction, int maxNumberOfServerInstances, System::IO::Pipes::PipeTransmissionMode transmissionMode, System::IO::Pipes::PipeOptions options, int inBufferSize, int outBufferSize, System::IO::Pipes::PipeSecurity ^ pipeSecurity);
public NamedPipeServerStream (string pipeName, System.IO.Pipes.PipeDirection direction, int maxNumberOfServerInstances, System.IO.Pipes.PipeTransmissionMode transmissionMode, System.IO.Pipes.PipeOptions options, int inBufferSize, int outBufferSize, System.IO.Pipes.PipeSecurity pipeSecurity);
new System.IO.Pipes.NamedPipeServerStream : string * System.IO.Pipes.PipeDirection * int * System.IO.Pipes.PipeTransmissionMode * System.IO.Pipes.PipeOptions * int * int * System.IO.Pipes.PipeSecurity -> System.IO.Pipes.NamedPipeServerStream
Public Sub New (pipeName As String, direction As PipeDirection, maxNumberOfServerInstances As Integer, transmissionMode As PipeTransmissionMode, options As PipeOptions, inBufferSize As Integer, outBufferSize As Integer, pipeSecurity As PipeSecurity)

参数

pipeName
String

管道的名称。The name of the pipe.

direction
PipeDirection

确定管道方向的枚举值之一。One of the enumeration values that determines the direction of the pipe.

maxNumberOfServerInstances
Int32

共享同一名称的服务器实例的最大数量。The maximum number of server instances that share the same name. 可以为此值传递 MaxAllowedServerInstancesYou can pass MaxAllowedServerInstances for this value.

transmissionMode
PipeTransmissionMode

确定管道传输模式的枚举值之一。One of the enumeration values that determines the transmission mode of the pipe.

options
PipeOptions

确定如何打开或创建管道的枚举值之一。One of the enumeration values that determines how to open or create the pipe.

inBufferSize
Int32

一个大于 0 的正值,指示输入缓冲区大小。A positive value greater than 0 that indicates the input buffer size.

outBufferSize
Int32

一个大于 0 的正值,指示输出缓冲区大小。A positive value greater than 0 that indicates the output buffer size.

pipeSecurity
PipeSecurity

一个对象,确定管道的访问控制和审核安全性。An object that determines the access control and audit security for the pipe.

例外

pipeNamenullpipeName is null.

pipeName 是一个长度为零的字符串。pipeName is a zero-length string.

pipeName 设置为“匿名”。pipeName is set to "anonymous".

- 或 --or- direction 不是有效的 PipeDirection 值。direction is not a valid PipeDirection value.

- 或 --or- maxNumberofServerInstances 小于 -1 或大于 254(-1 指示 MaxAllowedServerInstancesmaxNumberofServerInstances is less than -1 or greater than 254 (-1 indicates MaxAllowedServerInstances) - 或 --or- options 不是有效的 PipeOptions 值。options is not a valid PipeOptions value.

- 或 --or- inBufferSize 为负数。inBufferSize is negative.

pipeName 包含一个冒号 (":")。pipeName contains a colon (":").

操作系统是不受支持的 Windows Millennium Edition、Windows 98 或 Windows 95。The operating system is Windows Millennium Edition, Windows 98, or Windows 95, which are not supported.

已超出服务器实例的最大数量。The maximum number of server instances has been exceeded.

注解

此构造函数将创建一个具有以下特征的 NamedPipeServerStream 对象:This constructor creates a NamedPipeServerStream object that has the following characteristics:

NamedPipeServerStream(String, PipeDirection, Int32, PipeTransmissionMode, PipeOptions, Int32, Int32)

使用指定的管道名称、管道方向、最大数量的服务器实例、传输模式、管道选项和建议的输入输出缓冲区大小初始化 NamedPipeServerStream 类的新实例。Initializes a new instance of the NamedPipeServerStream class with the specified pipe name, pipe direction, maximum number of server instances, transmission mode, pipe options, and recommended in and out buffer sizes.

public:
 NamedPipeServerStream(System::String ^ pipeName, System::IO::Pipes::PipeDirection direction, int maxNumberOfServerInstances, System::IO::Pipes::PipeTransmissionMode transmissionMode, System::IO::Pipes::PipeOptions options, int inBufferSize, int outBufferSize);
public NamedPipeServerStream (string pipeName, System.IO.Pipes.PipeDirection direction, int maxNumberOfServerInstances, System.IO.Pipes.PipeTransmissionMode transmissionMode, System.IO.Pipes.PipeOptions options, int inBufferSize, int outBufferSize);
new System.IO.Pipes.NamedPipeServerStream : string * System.IO.Pipes.PipeDirection * int * System.IO.Pipes.PipeTransmissionMode * System.IO.Pipes.PipeOptions * int * int -> System.IO.Pipes.NamedPipeServerStream
Public Sub New (pipeName As String, direction As PipeDirection, maxNumberOfServerInstances As Integer, transmissionMode As PipeTransmissionMode, options As PipeOptions, inBufferSize As Integer, outBufferSize As Integer)

参数

pipeName
String

管道的名称。The name of the pipe.

direction
PipeDirection

确定管道方向的枚举值之一。One of the enumeration values that determines the direction of the pipe.

maxNumberOfServerInstances
Int32

共享同一名称的服务器实例的最大数量。The maximum number of server instances that share the same name. 可以为此值传递 MaxAllowedServerInstancesYou can pass MaxAllowedServerInstances for this value.

transmissionMode
PipeTransmissionMode

确定管道传输模式的枚举值之一。One of the enumeration values that determines the transmission mode of the pipe.

options
PipeOptions

确定如何打开或创建管道的枚举值之一。One of the enumeration values that determines how to open or create the pipe.

inBufferSize
Int32

一个大于 0 的正值,指示输入缓冲区大小。A positive value greater than 0 that indicates the input buffer size.

outBufferSize
Int32

一个大于 0 的正值,指示输出缓冲区大小。A positive value greater than 0 that indicates the output buffer size.

例外

pipeNamenullpipeName is null.

pipeName 是一个长度为零的字符串。pipeName is a zero-length string.

pipeName 设置为“匿名”。pipeName is set to "anonymous".

- 或 --or- direction 不是有效的 PipeDirection 值。direction is not a valid PipeDirection value.

- 或 --or- maxNumberofServerInstances 小于 -1 或大于 254(-1 指示 MaxAllowedServerInstancesmaxNumberofServerInstances is less than -1 or greater than 254 (-1 indicates MaxAllowedServerInstances) - 或 --or- options 不是有效的 PipeOptions 值。options is not a valid PipeOptions value.

- 或 --or- inBufferSize 为负数。inBufferSize is negative.

pipeName 包含一个冒号 (":")。pipeName contains a colon (":").

操作系统是不受支持的 Windows Millennium Edition、Windows 98 或 Windows 95。The operating system is Windows Millennium Edition, Windows 98, or Windows 95, which are not supported.

已超出服务器实例的最大数量。The maximum number of server instances has been exceeded.

注解

此构造函数将创建一个具有以下特征的 NamedPipeServerStream 对象:This constructor creates a NamedPipeServerStream object that has the following characteristics:

NamedPipeServerStream(String, PipeDirection, Int32, PipeTransmissionMode, PipeOptions)

使用指定的管道名称、管道方向、最大数量的服务器实例、传输模式和管道选项初始化 NamedPipeServerStream 类的新实例。Initializes a new instance of the NamedPipeServerStream class with the specified pipe name, pipe direction, maximum number of server instances, transmission mode, and pipe options.

public:
 NamedPipeServerStream(System::String ^ pipeName, System::IO::Pipes::PipeDirection direction, int maxNumberOfServerInstances, System::IO::Pipes::PipeTransmissionMode transmissionMode, System::IO::Pipes::PipeOptions options);
public NamedPipeServerStream (string pipeName, System.IO.Pipes.PipeDirection direction, int maxNumberOfServerInstances, System.IO.Pipes.PipeTransmissionMode transmissionMode, System.IO.Pipes.PipeOptions options);
new System.IO.Pipes.NamedPipeServerStream : string * System.IO.Pipes.PipeDirection * int * System.IO.Pipes.PipeTransmissionMode * System.IO.Pipes.PipeOptions -> System.IO.Pipes.NamedPipeServerStream
Public Sub New (pipeName As String, direction As PipeDirection, maxNumberOfServerInstances As Integer, transmissionMode As PipeTransmissionMode, options As PipeOptions)

参数

pipeName
String

管道的名称。The name of the pipe.

direction
PipeDirection

确定管道方向的枚举值之一。One of the enumeration values that determines the direction of the pipe.

maxNumberOfServerInstances
Int32

共享同一名称的服务器实例的最大数量。The maximum number of server instances that share the same name. 可以为此值传递 MaxAllowedServerInstancesYou can pass MaxAllowedServerInstances for this value.

transmissionMode
PipeTransmissionMode

确定管道传输模式的枚举值之一。One of the enumeration values that determines the transmission mode of the pipe.

options
PipeOptions

确定如何打开或创建管道的枚举值之一。One of the enumeration values that determines how to open or create the pipe.

例外

pipeNamenullpipeName is null.

pipeName 是一个长度为零的字符串。pipeName is a zero-length string.

pipeName 设置为“匿名”。pipeName is set to "anonymous".

- 或 --or- direction 不是有效的 PipeDirection 值。direction is not a valid PipeDirection value.

- 或 --or- maxNumberofServerInstances 小于 -1 或大于 254(-1 指示 MaxAllowedServerInstancesmaxNumberofServerInstances is less than -1 or greater than 254 (-1 indicates MaxAllowedServerInstances) - 或 --or- options 不是有效的 PipeOptions 值。options is not a valid PipeOptions value.

pipeName 包含一个冒号 (":")。pipeName contains a colon (":").

操作系统是不受支持的 Windows Millennium Edition、Windows 98 或 Windows 95。The operating system is Windows Millennium Edition, Windows 98, or Windows 95, which are not supported.

已超出服务器实例的最大数量。The maximum number of server instances has been exceeded.

注解

此构造函数将创建一个具有以下特征的 NamedPipeServerStream 对象:This constructor creates a NamedPipeServerStream object that has the following characteristics:

NamedPipeServerStream(String, PipeDirection, Int32, PipeTransmissionMode, PipeOptions, Int32, Int32, PipeSecurity, HandleInheritability, PipeAccessRights)

使用指定的管道名称、管道方向、最大数量的服务器实例、传输模式、管道选项、建议的输入输出缓冲区大小、管道安全性、继承模式和管道访问权限初始化 NamedPipeServerStream 类的新实例。Initializes a new instance of the NamedPipeServerStream class with the specified pipe name, pipe direction, maximum number of server instances, transmission mode, pipe options, recommended in and out buffer sizes, pipe security, inheritability mode, and pipe access rights.

public:
 NamedPipeServerStream(System::String ^ pipeName, System::IO::Pipes::PipeDirection direction, int maxNumberOfServerInstances, System::IO::Pipes::PipeTransmissionMode transmissionMode, System::IO::Pipes::PipeOptions options, int inBufferSize, int outBufferSize, System::IO::Pipes::PipeSecurity ^ pipeSecurity, System::IO::HandleInheritability inheritability, System::IO::Pipes::PipeAccessRights additionalAccessRights);
[System.Security.SecurityCritical]
public NamedPipeServerStream (string pipeName, System.IO.Pipes.PipeDirection direction, int maxNumberOfServerInstances, System.IO.Pipes.PipeTransmissionMode transmissionMode, System.IO.Pipes.PipeOptions options, int inBufferSize, int outBufferSize, System.IO.Pipes.PipeSecurity pipeSecurity, System.IO.HandleInheritability inheritability, System.IO.Pipes.PipeAccessRights additionalAccessRights);
public NamedPipeServerStream (string pipeName, System.IO.Pipes.PipeDirection direction, int maxNumberOfServerInstances, System.IO.Pipes.PipeTransmissionMode transmissionMode, System.IO.Pipes.PipeOptions options, int inBufferSize, int outBufferSize, System.IO.Pipes.PipeSecurity pipeSecurity, System.IO.HandleInheritability inheritability, System.IO.Pipes.PipeAccessRights additionalAccessRights);
new System.IO.Pipes.NamedPipeServerStream : string * System.IO.Pipes.PipeDirection * int * System.IO.Pipes.PipeTransmissionMode * System.IO.Pipes.PipeOptions * int * int * System.IO.Pipes.PipeSecurity * System.IO.HandleInheritability * System.IO.Pipes.PipeAccessRights -> System.IO.Pipes.NamedPipeServerStream
Public Sub New (pipeName As String, direction As PipeDirection, maxNumberOfServerInstances As Integer, transmissionMode As PipeTransmissionMode, options As PipeOptions, inBufferSize As Integer, outBufferSize As Integer, pipeSecurity As PipeSecurity, inheritability As HandleInheritability, additionalAccessRights As PipeAccessRights)

参数

pipeName
String

管道的名称。The name of the pipe.

direction
PipeDirection

确定管道方向的枚举值之一。One of the enumeration values that determines the direction of the pipe.

maxNumberOfServerInstances
Int32

共享同一名称的服务器实例的最大数量。The maximum number of server instances that share the same name. 可以为此值传递 MaxAllowedServerInstancesYou can pass MaxAllowedServerInstances for this value.

transmissionMode
PipeTransmissionMode

确定管道传输模式的枚举值之一。One of the enumeration values that determines the transmission mode of the pipe.

options
PipeOptions

确定如何打开或创建管道的枚举值之一。One of the enumeration values that determines how to open or create the pipe.

inBufferSize
Int32

输入缓冲区大小。The input buffer size.

outBufferSize
Int32

输出缓冲区大小。The output buffer size.

pipeSecurity
PipeSecurity

一个对象,确定管道的访问控制和审核安全性。An object that determines the access control and audit security for the pipe.

inheritability
HandleInheritability

确定基础句柄能否由子进程继承的枚举值之一。One of the enumeration values that determines whether the underlying handle can be inherited by child processes.

additionalAccessRights
PipeAccessRights

枚举值之一,指定管道的访问权限。One of the enumeration values that specifies the access rights of the pipe.

属性

例外

pipeNamenullpipeName is null.

pipeName 是一个长度为零的字符串。pipeName is a zero-length string.

pipeName 设置为“匿名”。pipeName is set to "anonymous".

- 或 --or- direction 不是有效的 PipeDirection 值。direction is not a valid PipeDirection value.

- 或 --or- maxNumberofServerInstances 小于 -1 或大于 254(-1 指示 MaxAllowedServerInstancesmaxNumberofServerInstances is less than -1 or greater than 254 (-1 indicates MaxAllowedServerInstances) - 或 --or- options 不是有效的 PipeOptions 值。options is not a valid PipeOptions value.

- 或 --or- inBufferSize 为负数。inBufferSize is negative.

- 或 --or- inheritability 不是有效的 HandleInheritability 值。inheritability is not a valid HandleInheritability value.

- 或 --or- additionalAccessRights 不是有效的 PipeAccessRights 值。additionalAccessRights is not a valid PipeAccessRights value.

pipeName 包含一个冒号 (":")。pipeName contains a colon (":").

操作系统是不受支持的 Windows Millennium Edition、Windows 98 或 Windows 95。The operating system is Windows Millennium Edition, Windows 98, or Windows 95, which are not supported.

已超出服务器实例的最大数量。The maximum number of server instances has been exceeded.

NamedPipeServerStream(PipeDirection, Boolean, Boolean, SafePipeHandle)

从指定的管道句柄初始化 NamedPipeServerStream 类的一个新实例。Initializes a new instance of the NamedPipeServerStream class from the specified pipe handle.

public:
 NamedPipeServerStream(System::IO::Pipes::PipeDirection direction, bool isAsync, bool isConnected, Microsoft::Win32::SafeHandles::SafePipeHandle ^ safePipeHandle);
public NamedPipeServerStream (System.IO.Pipes.PipeDirection direction, bool isAsync, bool isConnected, Microsoft.Win32.SafeHandles.SafePipeHandle safePipeHandle);
[System.Security.SecurityCritical]
public NamedPipeServerStream (System.IO.Pipes.PipeDirection direction, bool isAsync, bool isConnected, Microsoft.Win32.SafeHandles.SafePipeHandle safePipeHandle);
new System.IO.Pipes.NamedPipeServerStream : System.IO.Pipes.PipeDirection * bool * bool * Microsoft.Win32.SafeHandles.SafePipeHandle -> System.IO.Pipes.NamedPipeServerStream
Public Sub New (direction As PipeDirection, isAsync As Boolean, isConnected As Boolean, safePipeHandle As SafePipeHandle)

参数

direction
PipeDirection

确定管道方向的枚举值之一。One of the enumeration values that determines the direction of the pipe.

isAsync
Boolean

true 指示句柄已异步打开;否则为 falsetrue to indicate that the handle was opened asynchronously; otherwise, false.

isConnected
Boolean

指示管道已连接,则为 true;否则为 falsetrue to indicate that the pipe is connected; otherwise, false.

safePipeHandle
SafePipeHandle

NamedPipeServerStream 对象将封装的管道的安全句柄。A safe handle for the pipe that this NamedPipeServerStream object will encapsulate.

属性

例外

direction 不是有效的 PipeDirection 值。direction is not a valid PipeDirection value.

safePipeHandlenullsafePipeHandle is null.

safePipeHandle 是无效的句柄。safePipeHandle is an invalid handle.

safePipeHandle 不是有效的管道句柄。safePipeHandle is not a valid pipe handle.

- 或 --or- 已超出服务器实例的最大数量。The maximum number of server instances has been exceeded.

NamedPipeServerStream(String, PipeDirection, Int32)

使用指定的管道名称、管道方向和最大数量的服务器实例初始化 NamedPipeServerStream 类的一个新实例。Initializes a new instance of the NamedPipeServerStream class with the specified pipe name, pipe direction, and maximum number of server instances.

public:
 NamedPipeServerStream(System::String ^ pipeName, System::IO::Pipes::PipeDirection direction, int maxNumberOfServerInstances);
public NamedPipeServerStream (string pipeName, System.IO.Pipes.PipeDirection direction, int maxNumberOfServerInstances);
new System.IO.Pipes.NamedPipeServerStream : string * System.IO.Pipes.PipeDirection * int -> System.IO.Pipes.NamedPipeServerStream
Public Sub New (pipeName As String, direction As PipeDirection, maxNumberOfServerInstances As Integer)

参数

pipeName
String

管道的名称。The name of the pipe.

direction
PipeDirection

确定管道方向的枚举值之一。One of the enumeration values that determines the direction of the pipe.

maxNumberOfServerInstances
Int32

共享同一名称的服务器实例的最大数量。The maximum number of server instances that share the same name. 可以为此值传递 MaxAllowedServerInstancesYou can pass MaxAllowedServerInstances for this value.

例外

pipeNamenullpipeName is null.

pipeName 是一个长度为零的字符串。pipeName is a zero-length string.

pipeName 设置为“匿名”。pipeName is set to "anonymous".

- 或 --or- direction 不是有效的 PipeDirection 值。direction is not a valid PipeDirection value.

- 或 --or- 需要非负数。A non-negative number is required.

- 或 --or- maxNumberofServerInstances 小于 -1 或大于 254(-1 指示 MaxAllowedServerInstancesmaxNumberofServerInstances is less than -1 or greater than 254 (-1 indicates MaxAllowedServerInstances) - 或 --or- 需要 NoneInheritableNone or Inheritable is required.

- 或 --or- 访问权限仅限于 ChangePermissionsTakeOwnershipAccessSystemSecurity 标志。Access rights is limited to the ChangePermissions , TakeOwnership , and AccessSystemSecurity flags.

pipeName 包含一个冒号 (":")。pipeName contains a colon (":").

操作系统是不受支持的 Windows Millennium Edition、Windows 98 或 Windows 95。The operating system is Windows Millennium Edition, Windows 98, or Windows 95, which are not supported.

已超出服务器实例的最大数量。The maximum number of server instances has been exceeded.

注解

此构造函数将创建一个具有以下特征的 NamedPipeServerStream 对象:This constructor creates a NamedPipeServerStream object that has the following characteristics:

NamedPipeServerStream(String, PipeDirection)

使用指定的管道名称和管道方向初始化 NamedPipeServerStream 类的新实例。Initializes a new instance of the NamedPipeServerStream class with the specified pipe name and pipe direction.

public:
 NamedPipeServerStream(System::String ^ pipeName, System::IO::Pipes::PipeDirection direction);
public NamedPipeServerStream (string pipeName, System.IO.Pipes.PipeDirection direction);
new System.IO.Pipes.NamedPipeServerStream : string * System.IO.Pipes.PipeDirection -> System.IO.Pipes.NamedPipeServerStream
Public Sub New (pipeName As String, direction As PipeDirection)

参数

pipeName
String

管道的名称。The name of the pipe.

direction
PipeDirection

确定管道方向的枚举值之一。One of the enumeration values that determines the direction of the pipe.

例外

pipeNamenullpipeName is null.

pipeName 是一个长度为零的字符串。pipeName is a zero-length string.

pipeName 设置为“匿名”。pipeName is set to "anonymous".

- 或 --or- direction 不是有效的 PipeDirection 值。direction is not a valid PipeDirection value.

pipeName 包含一个冒号 (":")。pipeName contains a colon (":").

操作系统是不受支持的 Windows Millennium Edition、Windows 98 或 Windows 95。The operating system is Windows Millennium Edition, Windows 98, or Windows 95, which are not supported.

已超出服务器实例的最大数量。The maximum number of server instances has been exceeded.

示例

下面的示例演示了使用命名管道将字符串从父进程发送到子进程的方法。The following example demonstrates a method to send a string from a parent process to a child process using named pipes. 此示例在父进程中创建一个 NamedPipeServerStream 对象。This example creates a NamedPipeServerStream object in a parent process. NamedPipeServerStream 对象的 PipeDirection 值为 Out,则在 NamedPipeClientStream 对象与当前 NamedPipeServerStream 对象建立连接之前,该对象将被阻止。The NamedPipeServerStream object has a PipeDirection value of Out, which then blocks until a NamedPipeClientStream object establishes a connection to the current NamedPipeServerStream object.

using System;
using System.IO;
using System.IO.Pipes;

class PipeServer
{
    static void Main()
    {
        using (NamedPipeServerStream pipeServer =
            new NamedPipeServerStream("testpipe", PipeDirection.Out))
        {
            Console.WriteLine("NamedPipeServerStream object created.");

            // Wait for a client to connect
            Console.Write("Waiting for client connection...");
            pipeServer.WaitForConnection();

            Console.WriteLine("Client connected.");
            try
            {
                // Read user input and send that to the client process.
                using (StreamWriter sw = new StreamWriter(pipeServer))
                {
                    sw.AutoFlush = true;
                    Console.Write("Enter text: ");
                    sw.WriteLine(Console.ReadLine());
                }
            }
            // Catch the IOException that is raised if the pipe is broken
            // or disconnected.
            catch (IOException e)
            {
                Console.WriteLine("ERROR: {0}", e.Message);
            }
        }
    }
}
Imports System.IO
Imports System.IO.Pipes

Class PipeServer

    Shared Sub Main()
        Dim pipeServer As New NamedPipeServerStream("testpipe", PipeDirection.Out)

        Console.WriteLine("NamedPipeServerStream object created.")

        ' Wait for a client to connect
        Console.Write("Waiting for a client connection...")
        pipeServer.WaitForConnection()

        Console.WriteLine("Client connected.")
        Try
            'Read user input and send that to the client process.
            Dim sw As New StreamWriter(pipeServer)
            sw.AutoFlush = True
            Console.Write("Enter Text: ")
            sw.WriteLine(Console.ReadLine())
        Catch ex As IOException
            ' Catch the IOException that is raised if the pipe is broken
            ' or disconnected
            Console.WriteLine("ERROR: {0}", ex.Message)
        End Try
    End Sub
End Class

注解

此构造函数将创建一个具有以下特征的 NamedPipeServerStream 对象:This constructor creates a NamedPipeServerStream object that has the following characteristics:

NamedPipeServerStream(String, PipeDirection, Int32, PipeTransmissionMode)

使用指定的管道名称、管道方向、最大数量的服务器实例和传输模式初始化 NamedPipeServerStream 类的新实例。Initializes a new instance of the NamedPipeServerStream class with the specified pipe name, pipe direction, maximum number of server instances, and transmission mode.

public:
 NamedPipeServerStream(System::String ^ pipeName, System::IO::Pipes::PipeDirection direction, int maxNumberOfServerInstances, System::IO::Pipes::PipeTransmissionMode transmissionMode);
public NamedPipeServerStream (string pipeName, System.IO.Pipes.PipeDirection direction, int maxNumberOfServerInstances, System.IO.Pipes.PipeTransmissionMode transmissionMode);
new System.IO.Pipes.NamedPipeServerStream : string * System.IO.Pipes.PipeDirection * int * System.IO.Pipes.PipeTransmissionMode -> System.IO.Pipes.NamedPipeServerStream
Public Sub New (pipeName As String, direction As PipeDirection, maxNumberOfServerInstances As Integer, transmissionMode As PipeTransmissionMode)

参数

pipeName
String

管道的名称。The name of the pipe.

direction
PipeDirection

确定管道方向的枚举值之一。One of the enumeration values that determines the direction of the pipe.

maxNumberOfServerInstances
Int32

共享同一名称的服务器实例的最大数量。The maximum number of server instances that share the same name. 可以为此值传递 MaxAllowedServerInstancesYou can pass MaxAllowedServerInstances for this value.

transmissionMode
PipeTransmissionMode

一个可确定管道传输模式的枚举值。One of the enumeration values that determines the transmission mode of the pipe.

例外

pipeNamenullpipeName is null.

pipeName 是一个长度为零的字符串。pipeName is a zero-length string.

pipeName 设置为“匿名”。pipeName is set to "anonymous".

- 或 --or- direction 不是有效的 PipeDirection 值。direction is not a valid PipeDirection value.

- 或 --or- maxNumberofServerInstances 小于 -1 或大于 254(-1 指示 MaxAllowedServerInstancesmaxNumberofServerInstances is less than -1 or greater than 254 (-1 indicates MaxAllowedServerInstances)

pipeName 包含一个冒号 (":")。pipeName contains a colon (":").

操作系统是不受支持的 Windows Millennium Edition、Windows 98 或 Windows 95。The operating system is Windows Millennium Edition, Windows 98, or Windows 95, which are not supported.

已超出服务器实例的最大数量。The maximum number of server instances has been exceeded.

注解

此构造函数将创建一个具有以下特征的 NamedPipeServerStream 对象:This constructor creates a NamedPipeServerStream object that has the following characteristics:

适用于