AnonymousPipeServerStream Constructors
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Initialiseert een nieuw exemplaar van de AnonymousPipeServerStream klasse.
Overloads
| Name | Description |
|---|---|
| AnonymousPipeServerStream() |
Initialiseert een nieuw exemplaar van de AnonymousPipeServerStream klasse. |
| AnonymousPipeServerStream(PipeDirection) |
Initialiseert een nieuw exemplaar van de AnonymousPipeServerStream klasse met de opgegeven pijprichting. |
| AnonymousPipeServerStream(PipeDirection, HandleInheritability) |
Initialiseert een nieuw exemplaar van de AnonymousPipeServerStream klasse met de opgegeven pijprichting en de overnamemodus. |
| AnonymousPipeServerStream(PipeDirection, SafePipeHandle, SafePipeHandle) |
Initialiseert een nieuw exemplaar van de AnonymousPipeServerStream klasse van de opgegeven pijpgrepen. |
| AnonymousPipeServerStream(PipeDirection, HandleInheritability, Int32) |
Initialiseert een nieuw exemplaar van de AnonymousPipeServerStream klasse met de opgegeven pijprichting, de overdraagbaarheidsmodus en de buffergrootte. |
| AnonymousPipeServerStream(PipeDirection, HandleInheritability, Int32, PipeSecurity) |
Initialiseert een nieuw exemplaar van de AnonymousPipeServerStream klasse met de opgegeven pijprichting, de modus overerfbaarheid, buffergrootte en pijpbeveiliging. |
AnonymousPipeServerStream()
Initialiseert een nieuw exemplaar van de AnonymousPipeServerStream klasse.
public:
AnonymousPipeServerStream();
public AnonymousPipeServerStream();
Public Sub New ()
Opmerkingen
Voor AnonymousPipeServerStream constructors zonder parameter PipeDirection is Outde standaardrichting . Een PipeDirection waarde van InOut wordt niet ondersteund omdat anonieme pijpen in één richting zijn gedefinieerd.
Met deze constructor maakt u een AnonymousPipeServerStream object met de standaardbuffergrootte, geen pijpbeveiliging en een HandleInheritability waarde van None.
Van toepassing op
AnonymousPipeServerStream(PipeDirection)
Initialiseert een nieuw exemplaar van de AnonymousPipeServerStream klasse met de opgegeven pijprichting.
public:
AnonymousPipeServerStream(System::IO::Pipes::PipeDirection direction);
public AnonymousPipeServerStream(System.IO.Pipes.PipeDirection direction);
new System.IO.Pipes.AnonymousPipeServerStream : System.IO.Pipes.PipeDirection -> System.IO.Pipes.AnonymousPipeServerStream
Public Sub New (direction As PipeDirection)
Parameters
- direction
- PipeDirection
Een van de opsommingswaarden die de richting van de pijp bepalen.
Anonieme pijpen kunnen slechts in één richting zijn, dus direction kan niet worden ingesteld op InOut.
Uitzonderingen
direction is ingesteld op InOut.
Opmerkingen
Een PipeDirection waarde van InOut wordt niet ondersteund omdat anonieme pijpen in één richting zijn gedefinieerd.
Met deze constructor maakt u een AnonymousPipeServerStream object met de standaardbuffergrootte, geen pijpbeveiliging en een HandleInheritability waarde van None.
Van toepassing op
AnonymousPipeServerStream(PipeDirection, HandleInheritability)
Initialiseert een nieuw exemplaar van de AnonymousPipeServerStream klasse met de opgegeven pijprichting en de overnamemodus.
public:
AnonymousPipeServerStream(System::IO::Pipes::PipeDirection direction, System::IO::HandleInheritability inheritability);
public AnonymousPipeServerStream(System.IO.Pipes.PipeDirection direction, System.IO.HandleInheritability inheritability);
new System.IO.Pipes.AnonymousPipeServerStream : System.IO.Pipes.PipeDirection * System.IO.HandleInheritability -> System.IO.Pipes.AnonymousPipeServerStream
Public Sub New (direction As PipeDirection, inheritability As HandleInheritability)
Parameters
- direction
- PipeDirection
Een van de opsommingswaarden die de richting van de pijp bepalen.
Anonieme pijpen kunnen slechts in één richting zijn, dus direction kan niet worden ingesteld op InOut.
- inheritability
- HandleInheritability
Een van de opsommingswaarden die bepaalt of de onderliggende ingang kan worden overgenomen door onderliggende processen. Moet zijn ingesteld op of NoneInheritable.
Uitzonderingen
inheritability is niet ingesteld op of NoneInheritable.
direction is ingesteld op InOut.
Voorbeelden
In het volgende voorbeeld ziet u een methode voor het verzenden van een tekenreeks van een bovenliggend proces naar een onderliggend proces met behulp van anonieme pijpen. In dit voorbeeld wordt een AnonymousPipeServerStream object gemaakt in een bovenliggend proces met een PipeDirection waarde van Out.
//<snippet01>
using System;
using System.IO;
using System.IO.Pipes;
using System.Diagnostics;
class PipeServer
{
static void Main()
{
Process pipeClient = new Process();
pipeClient.StartInfo.FileName = "pipeClient.exe";
using (AnonymousPipeServerStream pipeServer =
new AnonymousPipeServerStream(PipeDirection.Out,
HandleInheritability.Inheritable))
{
Console.WriteLine("[SERVER] Current TransmissionMode: {0}.",
pipeServer.TransmissionMode);
// Pass the client process a handle to the server.
pipeClient.StartInfo.Arguments =
pipeServer.GetClientHandleAsString();
pipeClient.StartInfo.UseShellExecute = false;
pipeClient.Start();
pipeServer.DisposeLocalCopyOfClientHandle();
try
{
// Read user input and send that to the client process.
using (StreamWriter sw = new StreamWriter(pipeServer))
{
sw.AutoFlush = true;
// Send a 'sync message' and wait for client to receive it.
sw.WriteLine("SYNC");
pipeServer.WaitForPipeDrain();
// Send the console input to the client process.
Console.Write("[SERVER] Enter text: ");
sw.WriteLine(Console.ReadLine());
}
}
// Catch the IOException that is raised if the pipe is broken
// or disconnected.
catch (IOException e)
{
Console.WriteLine("[SERVER] Error: {0}", e.Message);
}
}
pipeClient.WaitForExit();
pipeClient.Close();
Console.WriteLine("[SERVER] Client quit. Server terminating.");
}
}
//</snippet01>
'<snippet01>
Imports System.IO
Imports System.IO.Pipes
Imports System.Diagnostics
Class PipeServer
Shared Sub Main()
Dim pipeClient As New Process()
pipeClient.StartInfo.FileName = "pipeClient.exe"
Using pipeServer As New AnonymousPipeServerStream(PipeDirection.Out, _
HandleInheritability.Inheritable)
Console.WriteLine("[SERVER] Current TransmissionMode: {0}.",
pipeServer.TransmissionMode)
' Pass the client process a handle to the server.
pipeClient.StartInfo.Arguments = pipeServer.GetClientHandleAsString()
pipeClient.StartInfo.UseShellExecute = false
pipeClient.Start()
pipeServer.DisposeLocalCopyOfClientHandle()
Try
' Read user input and send that to the client process.
Using sw As New StreamWriter(pipeServer)
sw.AutoFlush = true
' Send a 'sync message' and wait for client to receive it.
sw.WriteLine("SYNC")
pipeServer.WaitForPipeDrain()
' Send the console input to the client process.
Console.Write("[SERVER] Enter text: ")
sw.WriteLine(Console.ReadLine())
End Using
Catch e As IOException
' Catch the IOException that is raised if the pipe is broken
' or disconnected.
Console.WriteLine("[SERVER] Error: {0}", e.Message)
End Try
End Using
pipeClient.WaitForExit()
pipeClient.Close()
Console.WriteLine("[SERVER] Client quit. Server terminating.")
End Sub
End Class
'</snippet01>
Opmerkingen
Een PipeDirection waarde van InOut wordt niet ondersteund omdat anonieme pijpen in één richting zijn gedefinieerd.
Met deze constructor maakt u een AnonymousPipeServerStream object met de standaardbuffergrootte en geen pipebeveiliging.
Van toepassing op
AnonymousPipeServerStream(PipeDirection, SafePipeHandle, SafePipeHandle)
Initialiseert een nieuw exemplaar van de AnonymousPipeServerStream klasse van de opgegeven pijpgrepen.
public:
AnonymousPipeServerStream(System::IO::Pipes::PipeDirection direction, Microsoft::Win32::SafeHandles::SafePipeHandle ^ serverSafePipeHandle, Microsoft::Win32::SafeHandles::SafePipeHandle ^ clientSafePipeHandle);
public AnonymousPipeServerStream(System.IO.Pipes.PipeDirection direction, Microsoft.Win32.SafeHandles.SafePipeHandle serverSafePipeHandle, Microsoft.Win32.SafeHandles.SafePipeHandle clientSafePipeHandle);
[System.Security.SecurityCritical]
public AnonymousPipeServerStream(System.IO.Pipes.PipeDirection direction, Microsoft.Win32.SafeHandles.SafePipeHandle serverSafePipeHandle, Microsoft.Win32.SafeHandles.SafePipeHandle clientSafePipeHandle);
new System.IO.Pipes.AnonymousPipeServerStream : System.IO.Pipes.PipeDirection * Microsoft.Win32.SafeHandles.SafePipeHandle * Microsoft.Win32.SafeHandles.SafePipeHandle -> System.IO.Pipes.AnonymousPipeServerStream
[<System.Security.SecurityCritical>]
new System.IO.Pipes.AnonymousPipeServerStream : System.IO.Pipes.PipeDirection * Microsoft.Win32.SafeHandles.SafePipeHandle * Microsoft.Win32.SafeHandles.SafePipeHandle -> System.IO.Pipes.AnonymousPipeServerStream
Public Sub New (direction As PipeDirection, serverSafePipeHandle As SafePipeHandle, clientSafePipeHandle As SafePipeHandle)
Parameters
- direction
- PipeDirection
Een van de opsommingswaarden die de richting van de pijp bepalen.
Anonieme pijpen kunnen slechts in één richting zijn, dus direction kan niet worden ingesteld op InOut.
- serverSafePipeHandle
- SafePipeHandle
Een veilige handgreep voor de pijp die door dit AnonymousPipeServerStream object wordt ingekapseld.
- clientSafePipeHandle
- SafePipeHandle
Een veilige ingang voor het AnonymousPipeClientStream object.
- Kenmerken
Uitzonderingen
serverSafePipeHandle of clientSafePipeHandle is een ongeldige ingang.
serverSafePipeHandle of clientSafePipeHandle is null.
direction is ingesteld op InOut.
Opmerkingen
Een PipeDirection waarde van InOut wordt niet ondersteund omdat anonieme pijpen in één richting zijn gedefinieerd.
Van toepassing op
AnonymousPipeServerStream(PipeDirection, HandleInheritability, Int32)
Initialiseert een nieuw exemplaar van de AnonymousPipeServerStream klasse met de opgegeven pijprichting, de overdraagbaarheidsmodus en de buffergrootte.
public:
AnonymousPipeServerStream(System::IO::Pipes::PipeDirection direction, System::IO::HandleInheritability inheritability, int bufferSize);
public AnonymousPipeServerStream(System.IO.Pipes.PipeDirection direction, System.IO.HandleInheritability inheritability, int bufferSize);
[System.Security.SecurityCritical]
public AnonymousPipeServerStream(System.IO.Pipes.PipeDirection direction, System.IO.HandleInheritability inheritability, int bufferSize);
new System.IO.Pipes.AnonymousPipeServerStream : System.IO.Pipes.PipeDirection * System.IO.HandleInheritability * int -> System.IO.Pipes.AnonymousPipeServerStream
[<System.Security.SecurityCritical>]
new System.IO.Pipes.AnonymousPipeServerStream : System.IO.Pipes.PipeDirection * System.IO.HandleInheritability * int -> System.IO.Pipes.AnonymousPipeServerStream
Public Sub New (direction As PipeDirection, inheritability As HandleInheritability, bufferSize As Integer)
Parameters
- direction
- PipeDirection
Een van de opsommingswaarden die de richting van de pijp bepalen.
Anonieme pijpen kunnen slechts in één richting zijn, dus direction kan niet worden ingesteld op InOut.
- inheritability
- HandleInheritability
Een van de opsommingswaarden die bepaalt of de onderliggende ingang kan worden overgenomen door onderliggende processen. Moet zijn ingesteld op of NoneInheritable.
- bufferSize
- Int32
De grootte van de buffer. Deze waarde moet groter zijn dan of gelijk zijn aan 0.
- Kenmerken
Uitzonderingen
direction is ingesteld op InOut.
Opmerkingen
Een PipeDirection waarde van InOut wordt niet ondersteund omdat anonieme pijpen in één richting zijn gedefinieerd.
Met deze constructor maakt u een AnonymousPipeServerStream object zonder pijpbeveiliging.
Van toepassing op
AnonymousPipeServerStream(PipeDirection, HandleInheritability, Int32, PipeSecurity)
Initialiseert een nieuw exemplaar van de AnonymousPipeServerStream klasse met de opgegeven pijprichting, de modus overerfbaarheid, buffergrootte en pijpbeveiliging.
public:
AnonymousPipeServerStream(System::IO::Pipes::PipeDirection direction, System::IO::HandleInheritability inheritability, int bufferSize, System::IO::Pipes::PipeSecurity ^ pipeSecurity);
[System.Security.SecurityCritical]
public AnonymousPipeServerStream(System.IO.Pipes.PipeDirection direction, System.IO.HandleInheritability inheritability, int bufferSize, System.IO.Pipes.PipeSecurity pipeSecurity);
public AnonymousPipeServerStream(System.IO.Pipes.PipeDirection direction, System.IO.HandleInheritability inheritability, int bufferSize, System.IO.Pipes.PipeSecurity pipeSecurity);
[<System.Security.SecurityCritical>]
new System.IO.Pipes.AnonymousPipeServerStream : System.IO.Pipes.PipeDirection * System.IO.HandleInheritability * int * System.IO.Pipes.PipeSecurity -> System.IO.Pipes.AnonymousPipeServerStream
new System.IO.Pipes.AnonymousPipeServerStream : System.IO.Pipes.PipeDirection * System.IO.HandleInheritability * int * System.IO.Pipes.PipeSecurity -> System.IO.Pipes.AnonymousPipeServerStream
Public Sub New (direction As PipeDirection, inheritability As HandleInheritability, bufferSize As Integer, pipeSecurity As PipeSecurity)
Parameters
- direction
- PipeDirection
Een van de opsommingswaarden die de richting van de pijp bepalen.
Anonieme pijpen kunnen slechts in één richting zijn, dus direction kan niet worden ingesteld op InOut.
- inheritability
- HandleInheritability
Een van de opsommingswaarden die bepaalt of de onderliggende ingang kan worden overgenomen door onderliggende processen.
- bufferSize
- Int32
De grootte van de buffer. Deze waarde moet groter zijn dan of gelijk zijn aan 0.
- pipeSecurity
- PipeSecurity
Een object dat de toegangsbeheer en controlebeveiliging voor de pijp bepaalt.
- Kenmerken
Uitzonderingen
direction is ingesteld op InOut.
Opmerkingen
Een PipeDirection waarde van InOut wordt niet ondersteund omdat anonieme pijpen in één richting zijn gedefinieerd.