title: TCP Socket receiving only a part of the message
body: <p>I am using the following code to perform a tcp socket connection and send a string to an IP. But sometimes in the response,  I not receiving the entire file</p>
  
  <pre><code>     Socket m_socClient;
          IPSelected ="1.1.2.3"
                  Port = "80"
                  string query ="My Query"
                  m_socClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                  System.Net.IPAddress remoteIPAddress = System.Net.IPAddress.Parse(IPSelected);
                  System.Net.IPEndPoint remoteEndPoint = new System.Net.IPEndPoint(remoteIPAddress, Port);
                  m_socClient.Connect(remoteEndPoint);
                  try
                  {
                      if (m_socClient.Connected)
                      {                       
                          var reQuestToSend = "";
  
  
                              reQuestToSend = string.Format("POST /TMHP/Request HTTP/1.1\r\nHost:{0}\r\nContent-Length:{1}\r\n\r\n{2}", "edi-webtest.tmhp.com", Query270.Length, Query270);
                          byte[] bytesToSend = Encoding.ASCII.GetBytes(reQuestToSend);
                          byteCount = m_socClient.Send(bytesToSend, SocketFlags.None);
                          byte[] bytesReceived = new byte[3000];
    byteCount = m_socClient.Receive(bytesReceived, SocketFlags.None);
                          Response271 = Encoding.ASCII.GetString(bytesReceived);
  
                      }
                  }
                  catch (Exception ex)
                  {
                      EVCommon.Log(ex.Message);
  
                  }
                  finally
                  {
                      m_socClient.Disconnect(false);
                      m_socClient.Close(5000);
                  }
  </code></pre>
  
  <p>I think the problem is with     byte[] bytesReceived = new byte[3000];
  Is there a way to not hardcode this number 3000. It works most of the time but for longer strings it gets only half of it.
  I want it be handling variable sized messages instead of setting the byte size to  30000
  Thank you</p>