Archives

Archives / 2012 / May
  • My BeginRead never calls my callback function, please help!

    So you have decided to do some awesome async network communication and you have settled about using NetworkStream, in System.Net.Sockets namespace. Perhaps the most important reason to choose NetworkStream over other encapsulations of socket communication is the fact that NetworkStream “is a” Stream and you can use it in any method that expects a Stream and it will work. This way you can write code that reads from or writes data to a System.IO.Stream such as FileStream, NetworkStream, etc. without knowing what kind of stream you will be working with, clairvoyant style.