[Live-devel] RTSP socket from a server remains open after a client disconnection

Ross Finlayson finlayson at live555.com
Wed May 30 10:28:36 PDT 2018


First, I assume that you’re referring to the per-client TCP socket that’s set up to handle each client’s RTSP commands/responses.  (In contrast, the server’s (single) main RTSP socket - on port 554 or 8554 - remains open as long as the server stays up.)

The per-client TCP socket gets closed (by the server) whenever it stops being readable.  But as long as it remains readable, then the socket remains open (and the corresponding “RTSPClientConnection” object remains alive), just in case the client decides to issue another RTSP command - e.g., to start another RTSP session by doing another “DESCRIBE”/“SETUP”/“PLAY” etc..  (Note that “RTSPClientSession” and “RTSPClientConnection” objects are independent.  Depending on the client’s behavior, it’s possible to have more than one client session use the same TCP connection, or more than one TCP connection being used for the same client session.)

So, in summary: There’s no bug here.  The TCP socket remains open because it remains readable (by the server), and it remains readable (by the server) because the client has not closed it.  If you kill the client application, then eventually (depending on the client and server OSs), the server’s TCP socket will stop being readable, and it’ll get closed.

(Note that when the RTSP session closed, then it will have sent out a RTCP “BYE” packet (before closing the RTP and RTCP sockets).  If the client received this “BYE” packet, then it should have closed down the TCP socket (at its end) then.  But perhaps in this case the client didn’t receive the RTCP “BYE” packet (because it was sent via UDP, and is thus not reliable?)


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/




More information about the live-devel mailing list