Пример #1
0
 public override void Write(byte[] buffer, int offset, int count)
 {
     var state = new StateObject();
     lock (_streamLock)
     {
         _stream.BeginWrite(buffer, offset, count, WriteCallback, state);
     }
     state.Done.WaitOne();
 }
Пример #2
0
 public override int Read(byte[] buffer, int offset, int count)
 {
     var state = new StateObject();
     lock (_streamLock)
     {
         _stream.BeginRead(buffer, offset, count, ReadCallback, state);
     }
     state.Done.WaitOne();
     return state.BytesRead;
 }