As mentioned in SCTP receive message function returning zero, sctp_recvmsg()
returns a length of 0
for a one-to-one SCTP connection (socket(PF_INET, SOCK_STREAM, IPPROTO_SCT)
) when the other side closes the connection.
What happens / is supposed to happen for a standards compliant implementation when I send an empty string (""
) with sctp_sendmsg()
through such a connection?
- (How) Does the receiving side tell apart whether I closed the connection or just sent an empty string/
- Or is it illegal to send an empty string?
I haven't yet come across anything explaining this.
EDIT: I should mention that for standard recv()
of SOCK_STREAM
(e.g. for TCP), receiving a 0-length buffer happens when the peer has performed an orderly shutdown, thus apparently you're not allowed to send()
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 sctp_recvmsg()
, so we can't really say "it's just like for TCP".