title: Print Stream Information
body: <p>im trying to print the information  sent  to port 2000   but all I get is “ System.Net.Sockets.NetworkStream” . is there a way to convert stream to a string?   Or a way  to just print the stream information directly .</p>
  
  <pre><code>        static void Main(string[] args)
      {
          while (true)
          {
              TcpListener TL = new TcpListener(IPAddress.Any, 2000);
              TL.Start();
              Socket S = TL.AcceptSocket();
              Stream SS = new NetworkStream(S);
              string MSG = SS.ToString(); 
              Console.WriteLine(MSG);
          }
      }
  </code></pre>
  
  <p>EDIT: here is the client </p>
  
  <pre><code>       static void Main(string[] args)
      {
  
              try
              {
                  TcpClient TC = new TcpClient();
                  TC.Connect("XXX.XXX.XXX.XXX", 2000);
                  NetworkStream Writer = TC.GetStream();
                  string MSG = Console.ReadLine();
                  byte[] pack = Encoding.ASCII.GetBytes(MSG);
                  Writer.Write(pack, 0, pack.Length);
                  Writer.Flush();
              }
              catch
              {
                  Console.WriteLine(" faild");
                  Console.ReadLine();
              }
  
  
      }
  </code></pre>
  
  <p>PS: also the application crashes  after execution </p>