[Live-devel] Detecting socket close when receiving streams via TCP

Barry Stump bstump at codemass.com
Tue Jul 17 11:15:21 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.

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**.  It's this last check for
zero that is missing, causing Live555 to continue checking the socket for
new data even though it has been closed by the server.

This problem can manifest both with RTP over TCP as well as the RTSP
commands. If the server (or intermediary firewall) closes the socket
without sending a RTSP response for example, the library will wait
indefinitely for a response that never comes.

Is there a simple way to add the check for zero for recvfrom() and bubble
the message up through the library so that RTSPClients can be notified?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120717/255c12e8/attachment.html>


More information about the live-devel mailing list