title: Sending And Receiving Sockets (TCP/IP)
body: <p>I know that it is possible that multiple packets would be stacked to the buffer to be read from and that a long packet might require a loop of multiple send attempts to be fully sent. But I have a question about packaging in these cases:</p>
  
  <ol>
  <li>If I call <em>recv</em> (or any alternative (low-level) function) when there are multiple packets awaiting to be read, would it return them all stacked into my buffer or only one of them (or part of the first one if my buffer is insufficient)?</li>
  <li>If I send a long packet which requires multiple iterations to be sent fully, does it count as a single packet or multiple packets? It's basically a question whether it marks that the package sent is not full?</li>
  </ol>
  
  <p>These questions came to my mind when I thought about web sockets packaging. Special characters are used to mark the beginning and end of a packet which sorta leads to a conclusion that it's not possible to separate multiple packages.</p>
  
  <p>P.S. All the questions are about TCP/IP but you are welcomed to share information (answers) about UDP as well.</p>