title: Read a Network Stream from a socket
body: <p>I am trying to read a Network Stream from a socket. I know that the Address Family of the socket is InterNetwork, the Socket Type is Stream and the Protocol Type is IP.</p>
  
  <p>I have an IPEndPoint which consists of the IP address and the port that I am trying to read from. </p>
  
  <pre><code>NetworkStream myNetworkStream;
  Socket socket;
  IPEndPoint maxPort = new IPEndPoint(IPAddress.Parse("x.x.x.x"), xxxx);
  
  socket =
      new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
  socket.Connect(maxPort);
  
  myNetworkStream = new NetworkStream(socket);
  
  while (myNetworkStream.DataAvailable == false)
  {
      Thread.Sleep(1);
  }
  
  byte[] buffer = new byte[1024];
  int offset = 0;
  int count = 1024;
  
  myNetworkStream.Read(buffer, offset, count);
  
  Console.ReadLine();
  </code></pre>
  
  <p>I know that data is available (I am writing my own version of an existing application and am using the source code as a reference) but the true/false Data Available property always remains false and I never hit my Console.Readline().</p>
  
  <p>What am I doing wrong here?</p>