> On Jun 23, 2023, at 1:03 AM, Willdoner Christian via live-devel 
> <live-de...@us.live555.com> wrote:
> 
> I think it is a windows problem again..
> Finally I managed to filter out the IP with
>             char ipbuff[INET_ADDRSTRLEN];
>                         inet_ntop(clientAddr.ss_family, &(((struct 
> sockaddr_in*)&clientAddr)->sin_addr), ipbuff, INET_ADDRSTRLEN);
> instead of the AddressString function.

FYI, this is the code that gets called (in our library: in 
“groupsock/NetAddress.cpp") to generate the string value of each address 
(“AddressString(addr).val()”):
        - For IPv4:
                fVal = new char[INET_ADDRSTRLEN];
                inet_ntop(AF_INET, &addr, fVal, INET_ADDRSTRLEN);
        - For IPv6:
                fVal = new char[INET6_ADDRSTRLEN];
                inet_ntop(AF_INET6, &addr, fVal, INET6_ADDRSTRLEN);
I don’t know why that’s not working for you.


>  I have now an additional question: Is there also a function where it is 
> detected that a client closes the stream similar to createNewClientConnection?

Yes.  Whenever the server detects that the connection is closed, it destroys 
the “RTSPClientConnection” object.  So, you can define your own subclass of 
“RTSPServer::RTSPClientConnection”, with its own destructor, e.g.,

        class myRTSPServer: public RTSPServer {
        ...
        private:
                class myRTSPClientConnection: public 
RTSPServer::RTSPClientConnection {
                        public:
                                myRTSPClientConnection( params )
                                        : RTSPServer::RTSPClientConnection( 
params ) {}
                                virtual ~myRTSPClientConnection() {
                                        // YOU KNOW THAT THE CONNECTION WAS 
CLOSED HERE
                                }
                }
        };

You will also need to change your new “createNewClientConnection()” 
implementation to create (and return) an object of class 
“myRTSPClientConnection”, rather than just calling 
"RTSPServer::createNewClientConnection()” as you did before.


> Would it also be possible to detect if the client presses start/play in the 
> media player i.e. not reopening a new connection?

Yes - define your own subclass of “RTSPServer::RTSPClientSession” (and also 
reimplement the virtual function “createNewClientSession()” to create and 
return an object of this new subclass).  Then reimplement the virtual function 
“handleCmd_PLAY()” in your new subclass - i.e.
        void myRTSPClientSession::handleCmd_PLAY( params ) {
                // Do whatever…
                RTSPClientSession::handleCmd_PLAY( params );
        }


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


_______________________________________________
live-devel mailing list
live-devel@lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to