title: Issue while connecting to a server via TcpClient
body: <p>I'm testing a application where I connect to a server with a TcpClient, sending strings and waiting for a response. This works when stepping through the app but when running it without breakpoints, the result is empty.</p>
  
  <p>To be specific: I want to contact a TS3 server.
  Here is the code:</p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          var response = new ServerConnection().GetResponse();
          Console.WriteLine("Response erhalten!");
          Console.WriteLine(response);
          Console.ReadKey();
      }
  }
  
  public class ServerConnection
  {
      public string GetResponse()
      {
          string result = "";
          using (var client = new TcpClient())
          {
              client.Connect(IPAddress.Parse("193.111.136.17"), 10011);
              using (var ns = client.GetStream())
              {
                  byte[] bytesToSend;
                  bytesToSend = Encoding.ASCII.GetBytes("help");
                  ns.Write(bytesToSend, 0, bytesToSend.Length);
                  byte[] response = new byte[1024];
                  if (ns.DataAvailable)
                      ns.Read(response, 0, response.Length);
  
                  using (var ms = new MemoryStream(response))
                  {
                      using (var sr = new StreamReader(ms))
                      {
                          result = sr.ReadToEnd();
                      }
                  }
              }
          }
  
          return result;
      }
  }
  </code></pre>
  
  <p>Can anyone tell me, WHY THE HELL the reponse is filled with <code>\0</code> when running it normally (resulting in blank text for <code>result</code>), but containing some "usefull" text when stepping through this? This drives me crazy... aaarg!!</p>
  
  <p>Thanks in advance!</p>