title: c# Sockets Receive the full Data
body: <p>I'm still stuck at Tcp Sockets , i'm currently working on a Server/Client Project 
  I'm Trying to receive the full Data that has been sent by the client but i don't get it all .
  <br>after some research , i get to know that <code>one Send doesnt surely mean one receive</code> , so i need to keep reading till the Buffer size hit the Size of the data sent .</p>
  
  <pre><code>    public void Connect()
      {
  
          try
          {
              _ThisSocket.Connect(this._HOST);
          }catch {}
  
          new Thread(() =&gt;
          {
              while (_ThisSocket.Connected)
              {
                  _ThisSocket.Receive(BufferSize, 0, 4, SocketFlags.None);
                  int Size = BitConverter.ToInt32(BufferSize, 0);
                  while (Size &gt; 0)
                  {
                      if (Size &lt; _ThisSocket.ReceiveBufferSize)
                      {
                          _Buffer = new byte[Size];
                      }
                      else
                      {
                          _Buffer = new byte[_ThisSocket.ReceiveBufferSize];
                      }
                      _ThisSocket.BeginReceive(_Buffer, 0, _Buffer.Length, SocketFlags.None, Receive, _Buffer.Length);
  
                  }
              }
          }
          ).Start();
  
  
      }
  
  private void Receive(IAsyncResult AR)
  {
      int Size = (int)AR.AsyncState;
      Byte[] buff = new Byte[Size];
      Array.Copy(_Buffer, buff, Size);
      String Data = Encoding.Unicode.GetString(buff);
      String Cmd = Crypter.Decrypt(Data);
      Switch(Cmd);
  
  }
  </code></pre>
  
  <p>i m still new to c# Sockets programming , i excuse for any faults !</p>