The client program i have written uses SCTP sockets for communication. I am using sctp_recvmsg to read the data available for a particular user from socket. I have noticed that at times sctp_recvmsg returns 0 value instead of number of bytes read or -1 indicating an error. I have checked my code and the socket from which data is being read is not closed. Can someone throw light on how can such a behavior be seen?
Thanks in Advance.
Regards, Sujay
According to this lksctp thread,
sctp_recvmsg()
returns 0 if the other side closed the connection when you are in a 1-to-1 SCP connection (see here for an explanation of one-to-one and one-to-many connections) - that is, when you create the socket withSOCK_STREAM
instead ofSOCK_SEQPACKET
.Quoting: