.NET Matters: Stream Pipeline


My latest .NET Matters column in MSDN Magazine is now available online.  In it, I discuss one approach to implementing a BlockingStream and using it to implement a StreamPipeline class.

Comments (9)

  1. john says:

    Hello Stehen,

    Very nice article but how do I compile the code?

    I’m using .net 2.0.

    Is Action<Stream, Stream> a 3.x thing ? Because for me, I can just find a System.Action <T>

    Thanks,

    John.

  2. Glad you liked the article.  The code requires .NET 3.5, as Action<T1,T2> is a new delegate type defined in System.Core.dll.

  3. rikace says:

    My question is about your last two articles "StreamPipeline and Asynch Stream".  To send data using a NetworkStream, assuming I have to compress and to encrypt the byte, is better use the PipeStream or the Asynch method (may be multicasting the delegates)??  and how I can upgrade the code to resolve the issue of the data size, because looping 0X1000 byte at the time with the encryption the size change most of the time.

    Thanks and best regards

    Riccardo

  4. You don’t have to choose; you can use them both together.  You can use a stream pipeline approach to overlap the encryption with the compression, and you can write the results asynchronously to the network stream.  Regarding reading 0x1000 bytes a time, it doesn’t matter if you actually get that many; when you call Read, the return value is the number of bytes actually read into the array, and you can then use just that many from the array.

  5. rikace says:

    Thanks,  I have done a combination of StreamPipeline and Asynch and work just pefect.

    Do you think that using the Parallel tools could increase the performance (using Future<T> and wait for the callback) or becasue is kind of sequntial (compress > encrypt > send ) system it is not possible?

  6. anonymous says:

    Hey Stephen, installing SP3 on my Tablet PC Edition 2005 broke Sudoku. Now it gives an error "requires Windows XP Tablet PC Edition 2005". I’ve installed the latest Ink 1.7 runtime, recognizer pack everything but after SP3 it doesn’t work. Please I don’t want to lose a game like MS Sudoku. Can Microsoft fix it to work with SP3?

  7. G says:

    Wish you had the adaptive huffman code sample available again. Useful especially when Silverlight does not offer IO.Compression stuff.

  8. Subrahmanyam Ponnuru says:

    HI Stephen,

    I am using the code provided in the below link to check the processes of locked files.

    msdn.microsoft.com/…/cc163450.aspx

    The code is working fine with the shorter file paths, but when we use it with longer file paths code is failing in the "RmRegisterResources" method, is there any way to check the longer file paths.

    thanks, subrahmanyam