title: What is the difference between NetworkStream and Socket classes?
body: <p>I have a project where I might want to abstract the communication between client and server. I was initially using Sockets and TCP. I then thought that it might be nice to be able to switch to an inter process communication channel. I then looked at System.IO.PipedStream class and saw that there was a lot of overlap between the PipeStream and the Socket class. But when I had a look at the Socket class it inherits from Object. So there is no common interface or abstract class between Socket and PipeStreams.</p>
  
  <p>I then remembered something about NetworkStream. It apparently wraps a Socket class. But at least both NetworkStream and PipeStream inherit from Stream. Which means I can swap my implementation out. I think, I haven't tried this yet. I have been using sockets all this time.</p>
  
  <p>So my question is: Is there any disadvantage to using the NetworkStream class over the Socket class. Any gotchas or anything to watch out for?</p>