[Live-devel] Get IP address of redirected RTSP servers

Liu, Eric liuri at amazon.com
Tue May 23 13:27:34 PDT 2023


Hi Ross,

Thanks for your response. Do you know if the ip address returned by these functions (connectionEndpointName,  getConnectionEndpointAddress) are specified by the end server or determined by the library? I'm testing this out and unfortunately the ip address does not seem to be set (it is always null or 0).

Best,
Eric Liu

On 5/23/23, 12:45 AM, "live-devel on behalf of Ross Finlayson" <live-devel-bounces at us.live555.com <mailto:live-devel-bounces at us.live555.com> on behalf of finlayson at live555.com <mailto:finlayson at live555.com>> wrote:






> On May 22, 2023, at 8:00 PM, Liu, Eric via live-devel <live-devel at us.live555.com <mailto:live-devel at us.live555.com>> wrote:
>
> I’m using the live555 RTSP client to connect to an RTSP server (server A) that redirects to the actual source of the video stream, server B. This works well out of the box and the client is able to receive frames from server B as expected. However, my use case requires me to additionally be able to get the ip address of server B. Is this possible with the live555 library, either by registering a callback or some other method?


The best way to do this would be to use the “source=“ parameter that’s in the response to each RTSP “SETUP” command. You can access this in your RTSP client code - in your callback function that handles the response to each “SETUP” - without having to modify or even extend the LIVE555 library code.


Using the “testRTSPClient” code (in the “testProgs“ directory) as an example, in the “continueAfterSETUP()” function at around line 276 of “testRTSPClient.cpp”, you could add:


char const* sourceStr = scs.subsession->connectionEndpointName(); // to get the source address, in string form
int sourceAddressFamily = scs.subsession->connectionEndpointNameAddressFamily(); // AF_INET or AF_INET6


Or, instead, if you want the source address in numeric form, add:
struct sockaddr_storage sourceAddress;
scs.subsession->getConnectionEndpointAddress(sourceAddress); // “sourceAddress” now contains the IP (v4 or v6) address of the source




> As a bonus, it would be great if there is a method to get the ip address of all intermediate redirects – for example, if my client connects to server A which redirects to server B which redirects to server C, is it possible to get the ip addresses of both server B and C?


In this case, because the presence of server B would be completely invisible to the RTSP client (it knows only the server to which it connects (A), and the source of its RTP packets (C)), there’s no possible way that the RTSP client could know about server B.




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




_______________________________________________
live-devel mailing list
live-devel at lists.live555.com <mailto:live-devel at lists.live555.com>
http://lists.live555.com/mailman/listinfo/live-devel <http://lists.live555.com/mailman/listinfo/live-devel>






More information about the live-devel mailing list