Edit

Share via


NamedPipeServerStream Constructors

Definition

Initializes a new instance of the NamedPipeServerStream class.

Overloads

NamedPipeServerStream(String)

Initializes a new instance of the NamedPipeServerStream class with the specified pipe name.

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

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)

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)

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)

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)

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)

Initializes a new instance of the NamedPipeServerStream class from the specified pipe handle.

NamedPipeServerStream(String, PipeDirection, Int32)

Initializes a new instance of the NamedPipeServerStream class with the specified pipe name, pipe direction, and maximum number of server instances.

NamedPipeServerStream(String, PipeDirection)

Initializes a new instance of the NamedPipeServerStream class with the specified pipe name and pipe direction.

NamedPipeServerStream(String, PipeDirection, Int32, PipeTransmissionMode)

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)

Source:
NamedPipeServerStream.cs
Source:
NamedPipeServerStream.cs
Source:
NamedPipeServerStream.cs

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)

Parameters

pipeName
String

The name of the pipe.

Exceptions

pipeName is null.

pipeName is a zero-length string.

pipeName is set to "anonymous".

pipeName contains a colon (":").

The maximum number of server instances has been exceeded.

Remarks

This constructor creates a NamedPipeServerStream object that has the following characteristics:

Applies to

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

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)

Parameters

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. You 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

A positive value greater than 0 that indicates the input buffer size.

outBufferSize
Int32

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.

Exceptions

pipeName is null.

pipeName is a zero-length string.

pipeName is set to "anonymous".

-or-

direction is not a valid PipeDirection value.

-or-

maxNumberofServerInstances is less than -1 or greater than 254 (-1 indicates MaxAllowedServerInstances)

-or-

options is not a valid PipeOptions value.

-or-

inBufferSize is negative.

-or-

inheritability is not a valid HandleInheritability value.

pipeName contains a colon (":").

The maximum number of server instances has been exceeded.

Remarks

This constructor creates a NamedPipeServerStream object that has no specified additional PipeAccessRights.

Applies to

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

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)

Parameters

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. You 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

A positive value greater than 0 that indicates the input buffer size.

outBufferSize
Int32

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.

Exceptions

pipeName is null.

pipeName is a zero-length string.

pipeName is set to "anonymous".

-or-

direction is not a valid PipeDirection value.

-or-

maxNumberofServerInstances is less than -1 or greater than 254 (-1 indicates MaxAllowedServerInstances)

-or-

options is not a valid PipeOptions value.

-or-

inBufferSize is negative.

pipeName contains a colon (":").

The maximum number of server instances has been exceeded.

Remarks

This constructor creates a NamedPipeServerStream object that has the following characteristics:

Applies to

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

Source:
NamedPipeServerStream.cs
Source:
NamedPipeServerStream.cs
Source:
NamedPipeServerStream.cs

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)

Parameters

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. You 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

A positive value greater than 0 that indicates the input buffer size.

outBufferSize
Int32

A positive value greater than 0 that indicates the output buffer size.

Exceptions

pipeName is null.

pipeName is a zero-length string.

pipeName is set to "anonymous".

-or-

direction is not a valid PipeDirection value.

-or-

maxNumberofServerInstances is less than -1 or greater than 254 (-1 indicates MaxAllowedServerInstances)

-or-

options is not a valid PipeOptions value.

-or-

inBufferSize is negative.

pipeName contains a colon (":").

The maximum number of server instances has been exceeded.

Remarks

This constructor creates a NamedPipeServerStream object that has the following characteristics:

Applies to

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

Source:
NamedPipeServerStream.cs
Source:
NamedPipeServerStream.cs
Source:
NamedPipeServerStream.cs

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)

Parameters

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. You 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.

Exceptions

pipeName is null.

pipeName is a zero-length string.

pipeName is set to "anonymous".

-or-

direction is not a valid PipeDirection value.

-or-

maxNumberofServerInstances is less than -1 or greater than 254 (-1 indicates MaxAllowedServerInstances)

-or-

options is not a valid PipeOptions value.

pipeName contains a colon (":").

The maximum number of server instances has been exceeded.

Remarks

This constructor creates a NamedPipeServerStream object that has the following characteristics:

Applies to

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

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);
[<System.Security.SecurityCritical>]
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
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)

Parameters

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. You 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.

Attributes

Exceptions

pipeName is null.

pipeName is a zero-length string.

pipeName is set to "anonymous".

-or-

direction is not a valid PipeDirection value.

-or-

maxNumberofServerInstances is less than -1 or greater than 254 (-1 indicates MaxAllowedServerInstances)

-or-

options is not a valid PipeOptions value.

-or-

inBufferSize is negative.

-or-

inheritability is not a valid HandleInheritability value.

-or-

additionalAccessRights is not a valid PipeAccessRights value.

pipeName contains a colon (":").

The maximum number of server instances has been exceeded.

Applies to

NamedPipeServerStream(PipeDirection, Boolean, Boolean, SafePipeHandle)

Source:
NamedPipeServerStream.Unix.cs
Source:
NamedPipeServerStream.Unix.cs
Source:
NamedPipeServerStream.Unix.cs

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
[<System.Security.SecurityCritical>]
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)

Parameters

direction
PipeDirection

One of the enumeration values that determines the direction of the pipe.

isAsync
Boolean

true to indicate that the handle was opened asynchronously; otherwise, false.

isConnected
Boolean

true to indicate that the pipe is connected; otherwise, false.

safePipeHandle
SafePipeHandle

A safe handle for the pipe that this NamedPipeServerStream object will encapsulate.

Attributes

Exceptions

direction is not a valid PipeDirection value.

safePipeHandle is null.

safePipeHandle is an invalid handle.

safePipeHandle is not a valid pipe handle.

-or-

The maximum number of server instances has been exceeded.

Applies to

NamedPipeServerStream(String, PipeDirection, Int32)

Source:
NamedPipeServerStream.cs
Source:
NamedPipeServerStream.cs
Source:
NamedPipeServerStream.cs

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)

Parameters

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. You can pass MaxAllowedServerInstances for this value.

Exceptions

pipeName is null.

pipeName is a zero-length string.

pipeName is set to "anonymous".

-or-

direction is not a valid PipeDirection value.

-or-

A non-negative number is required.

-or-

maxNumberofServerInstances is less than -1 or greater than 254 (-1 indicates MaxAllowedServerInstances)

-or-

None or Inheritable is required.

-or-

Access rights is limited to the ChangePermissions , TakeOwnership , and AccessSystemSecurity flags.

pipeName contains a colon (":").

The maximum number of server instances has been exceeded.

Remarks

This constructor creates a NamedPipeServerStream object that has the following characteristics:

Applies to

NamedPipeServerStream(String, PipeDirection)

Source:
NamedPipeServerStream.cs
Source:
NamedPipeServerStream.cs
Source:
NamedPipeServerStream.cs

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)

Parameters

pipeName
String

The name of the pipe.

direction
PipeDirection

One of the enumeration values that determines the direction of the pipe.

Exceptions

pipeName is null.

pipeName is a zero-length string.

pipeName is set to "anonymous".

-or-

direction is not a valid PipeDirection value.

pipeName contains a colon (":").

The maximum number of server instances has been exceeded.

Examples

The following example demonstrates a method to send a string from a parent process to a child process using named pipes. This example creates a NamedPipeServerStream object in a parent process. 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

Remarks

This constructor creates a NamedPipeServerStream object that has the following characteristics:

Applies to

NamedPipeServerStream(String, PipeDirection, Int32, PipeTransmissionMode)

Source:
NamedPipeServerStream.cs
Source:
NamedPipeServerStream.cs
Source:
NamedPipeServerStream.cs

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)

Parameters

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. You can pass MaxAllowedServerInstances for this value.

transmissionMode
PipeTransmissionMode

One of the enumeration values that determines the transmission mode of the pipe.

Exceptions

pipeName is null.

pipeName is a zero-length string.

pipeName is set to "anonymous".

-or-

direction is not a valid PipeDirection value.

-or-

maxNumberofServerInstances is less than -1 or greater than 254 (-1 indicates MaxAllowedServerInstances)

pipeName contains a colon (":").

The maximum number of server instances has been exceeded.

Remarks

This constructor creates a NamedPipeServerStream object that has the following characteristics:

Applies to