I call a dll that writes to the stream. The signature of the method in the dll looks like this:
public bool SomeMethod(Stream stream);
and this method will basically write binary data to this stream. Therefore, if I call this method as follows:
var file = System.IO.File.Create("SomeFile.txt"); SomeMethod(file);
then I will basically write the output to this file. In this question, I am writing output to networkStream.
In any case, back to the question . The reason I want to create my own thread is because I would like to know when some events happen. For example, if I create my own stream class as:
class MyStream : Stream { private long Position; public override int Read(byte[] buffer, int offset, int count) {
I am writing the output of this stream to the network, so I can slow down if an event occurs. If I have control over the dll, then I would not try to implement this.
I would appreciate it if someone could show me a very simple example of how to implement the abstract methods of the Stream abstract class.
Tono nam
source share