본문 바로가기
C#

[C#] PipeStream

by DANEW 2023. 12. 1.

PipeStream 클래스

 

PipeStream 클래스 (System.IO.Pipes)

익명 파이프와 명명된 파이프를 모두 지원하는 파이프 주위의 Stream 개체를 노출합니다.

learn.microsoft.com

namespace System.IO.Pipes
{
    public abstract class PipeStream : Stream
    {
        protected PipeStream(PipeDirection direction, int bufferSize);
        protected PipeStream(PipeDirection direction, PipeTransmissionMode transmissionMode, int outBufferSize);

        public override bool CanRead { get; }
        public override int Read(byte[] buffer, int offset, int count);
        public override int ReadByte();
        public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state);
        public override int EndRead(IAsyncResult asyncResult);

        
        public override bool CanWrite { get; }
        public override void Write(byte[] buffer, int offset, int count);
        public override void WriteByte(byte value);
        public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state);
        public override void EndWrite(IAsyncResult asyncResult);

        public override bool CanSeek { get; }
        public override long Position { get; set; }
        public override long Length { get; }
        public override void SetLength(long value);
        public override long Seek(long offset, SeekOrigin origin);
        
        public override void Flush();
        protected override void Dispose(bool disposing);

        public virtual int OutBufferSize { get; }
        public virtual int InBufferSize { get; }
        
        public bool IsAsync { get; }
        public bool IsConnected { get; protected set; }
        public bool IsMessageComplete { get; }
        protected bool IsHandleExposed { get; }

        public SafePipeHandle SafePipeHandle { get; }
        protected void InitializeHandle(SafePipeHandle handle, bool isExposed, bool isAsync);

        public virtual PipeTransmissionMode TransmissionMode { get; }
        public virtual PipeTransmissionMode ReadMode { get; set; }
        
        public PipeSecurity GetAccessControl();
        public void SetAccessControl(PipeSecurity pipeSecurity);
        public void WaitForPipeDrain();
        
        protected internal virtual void CheckPipePropertyOperations();
        protected internal void CheckReadOperations();
        protected internal void CheckWriteOperations();
    }
}
반응형

- .NET 3.5
- Windows의 Pipe 프로토콜을 사용을 통해 다른 프로세스와 교신
- 한 컴퓨터 안에서의 프로세스간 통신(IPC, Interprocess Communication)에 적합
- 네트워크 전송에 의존하지 않아 성능이 좋고 방화벽 관련 문제도 없음

- 추상 클래스이며 구현하는 4개 클래스 존재
 * 익명 파이프
  * AnonymousPipeServerStream
  * AnonymousPipeClientStream

 * 명명된 파이프
  * NamedPipeServerStream
  * NamedPipeClientStream

반응형

'C#' 카테고리의 다른 글

[C#] NamedPipeServerStream, NamedPipeClientStream  (0) 2023.12.04
[C#] MemoryStream  (0) 2023.11.24
[C#] FileStream  (0) 2023.11.20
[C#] Stream  (0) 2023.11.17
[C#] Task  (0) 2023.11.06
[C#] Thread  (0) 2023.11.01
[C#] Stopwatch  (0) 2023.10.30
[C#] PerformanceCounter, PerformanceCounterCategory  (0) 2023.10.28