[Live-devel] Detecting socket close when receiving streams via TCP
Ross Finlayson
finlayson at live555.com
Tue Jul 17 13:54:38 PDT 2012
> I am troubleshooting an issue similar to Dirk Dugger when receiving RTP over TCP via the RTSPClient class. If the server closes the connection mid stream, the client gets no notification.
As I also said in response to Dirk's question: In general it's a bad idea to complicate your application by trying to optimize the handling of an unusual situation.
This answer - to a similar question last month - outlines what I think is the best way to handle this situation (and other, more general situations):
http://lists.live555.com/pipermail/live-devel/2012-June/015348.html
However, concerning the specific problem that you referred to:
> I have traced the problem to the readSocket() function in GroupsockHelper.cpp where recvfrom() is used to get data from the socket. On posix systems, recvfrom() should return the number of bytes read, or a negative number on error, or **zero if the connection is TCP and the peer has closed its half side of the connection**.
I *might* be able to modify the "readSocket()" function to better handle this case, but I don't want to risk inadvertently messing up higher-level code that uses this function by mishandling cases when "recvfrom()" might return zero in a *non*-error situation.
In the situation that you are concerned about - recvfrom() returning "zero if the connection is TCP and the peer has closed its half side of the connection" - what is the value of "errno" in this case? (If it's something non-zero, then I should be able to update "readSocket()" to add a test for this.)
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120717/e179ceec/attachment.html>
More information about the live-devel
mailing list