sockets - SCTP receive message function returning zero -
the client program have written uses sctp sockets communication. using sctp_recvmsg read data available particular user socket. have noticed @ times sctp_recvmsg returns 0 value instead of number of bytes read or -1 indicating error. have checked code , socket data being read not closed. can throw light on how can such behavior seen?
thanks in advance.
regards, sujay
according this lksctp thread, sctp_recvmsg()
returns 0 if other side closed connection when in 1-to-1 scp connection (see here explanation of one-to-one , one-to-many connections) - is, when create socket sock_stream
instead of sock_seqpacket
.
quoting:
return values sctp_sendmsg , sctp_recvmsg not documented, suppose sctp_sendmsg return -1 , set errno econnreset same way sendmsg does. however, sctp_recvnmsg? plain recvmsg should return 0 if half-connection closed, there no half-connections in sctp. how function behave exactly?
the sctp_recvmsg() return 0 on termination on 1-to-1 sockets. however, above notifications work on both styles.
Comments
Post a Comment