Esempio n. 1
0
 public PipeClient(string pipeName)
 {
     this.pipeName = pipeName;
     client        = new PipeBaseForClient(".", this.pipeName, p => p.StartByteReaderAsync());
     client.Connect();
     client.DataReceived += OnReceive;
 }
Esempio n. 2
0
 public PipeClient(string pipeName, int timeoutMilliseconds)
 {
     this.pipeName = pipeName;
     client        = new PipeBaseForClient(".", this.pipeName, p => p.StartByteReaderAsync());
     client.Connect(timeoutMilliseconds);
     client.DataReceived += OnReceive;
 }
Esempio n. 3
0
        public bool Wait(int timeout = 10)
        {
            timeout *= 40;
            while (timeout > 0)
            {
                Thread.Sleep(25);
                if (CheckStatusSuccess() == true)
                {
                    return(true);
                }

                timeout -= 1;
            }

            if (this.pipeStatus == PipePacketStatus.Pending)
            {
                client.Close();
                client = new PipeBaseForClient(".", pipeName, p => p.StartByteReaderAsync());
                client.Connect();
                client.DataReceived += OnReceive;
            }

            return(false);
        }