title: C# Sockets - Sending a serialized object in a single packet
body: <p>I'm stuck at the concept of TCP as a stream-oriented protocol.</p>
  
  <p>While using Sockets or anything that uses that protocol there is no way to know how much data will be received in a single receive; so for example if we send 1024 bytes, it can be received in 3 Receive methods give or take.</p>
  
  <p>So we basically need to keep calling our receive methods until the buffer hits the size sent.</p>
  
  <p>I'm still struggling on network, I'm trying to get a bit comfortable using Client/Server applications. I found that the easiest way to do so is to create packets and send them over the network. </p>
  
  <p>So my question is: When serializing a Class as a packet that has - lets say a typeof <code>Normal.Message</code> - and has a <code>string</code> that holds the Message...</p>
  
  <pre><code>[Serializable]
  Class Message
  {
     String Msg;
     public Message(String msg)
     {
         This.Msg = msg;
     }
  }
  </code></pre>
  
  <p>...if we sent this packet, is it undetermined that it will be received in <strong>one</strong> Receive Method? And if not, what's the easiest way to ensure that it will?</p>