title: What happens when sending an empty string with sctp_recvmsg() to a SOCK_STREAM SCTP socket?
body: <p>As mentioned in <a href="https://stackoverflow.com/questions/21595181/sctp-receive-message-function-returning-zero/31898000">SCTP receive message function returning zero</a>, <code>sctp_recvmsg()</code> returns a length of <code>0</code> for a <a href="http://man7.org/linux/man-pages/man7/sctp.7.html" rel="nofollow noreferrer">one-to-one</a> SCTP  connection (<code>socket(PF_INET, SOCK_STREAM, IPPROTO_SCT)</code>) when the other side closes the connection.</p>
  
  <p>What happens / is supposed to happen for a standards compliant implementation when I send an empty string (<code>""</code>) with <code>sctp_sendmsg()</code> through such a connection?</p>
  
  <ul>
  <li>(How) Does the receiving side tell apart whether I closed the connection or just sent an empty string/</li>
  <li>Or is it illegal to send an empty string?</li>
  </ul>
  
  <p>I haven't yet come across anything explaining this.</p>
  
  <p><strong>EDIT:</strong> I should mention that for standard <code>recv()</code> of <code>SOCK_STREAM</code> (e.g. for TCP), receiving a 0-length buffer happens <a href="http://linux.die.net/man/2/recv" rel="nofollow noreferrer">when the peer has performed an orderly shutdown</a>, thus <a href="https://stackoverflow.com/a/3363496/263061">apparently</a> you're not allowed to <code>send()</code> an empty string in TCP. For a stream-only protocol like TCP this makes total sense, since 0-length data cannot have a meaning in a stream. But it could well have a meaning for a datagram as in the case of <code>sctp_recvmsg()</code>, so we can't really say <em>"it's just like for TCP"</em>.</p>