<div dir="ltr">Hi Ross, <br><br>Thanks for you feedback again. One question. I'm confused about the order of operations, then. You claim I should call .changeDestinationparameters() with the sender's IP on the rtcpGroupSock before invoking RTCPInstance::createNew() on said socket, but before receiving the sender's IP I need to get traffic from it, and before getting traffic, don't I need to have invoked RTCPInstance::createNew()? <br><br>My understanding of the order is: <br><br>1. Create sink, <br>2. Create sockets, <br>3. Create RTP source, <br>4. Create RTCP instance, <br>5. Receive audio traffic, get sender's IP. <br>6. Then maybe update stuff with changeDestinationParameters()?  <br><br>Or am I misunderstanding what you're saying? Apologies if I'm being dense. <br><br><div class="gmail_quote"><div dir="ltr">On Tue, Jun 14, 2016 at 1:39 AM Ross Finlayson <<a href="mailto:finlayson@live555.com" target="_blank">finlayson@live555.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> I'm creating an audio "client" using RTPSource. I have a custom MediaSink-derived class which takes the traffic and routes it to my computer's audio device. Works great.<br>
><br>
> What I'd like to do, however, is retrieve the sender's IP address (the IP address of the sender which is sending traffic to the port/ip as specified by my GroupSocks). How do I do this?<br>
<br>
Unfortunately the sender’s IP address (and port number) aren’t exposed directly by our “*RTPSource” code, but there is a hack that you can use to get this.<br>
<br>
The trick (hack) is to define a subclass of the “Groupsock” class, and, in your subclass, reimplement the virtual function<br>
        virtual Boolean handleRead(unsigned char* buffer, unsigned bufferMaxSize, unsigned& bytesRead, struct sockaddr_in& fromAddressAndPort);<br>
In your subclass, you would implement this virtual function as follows:<br>
        Boolean yourGroupsockSubclass::handleRead(unsigned char* buffer, unsigned bufferMaxSize,<br>
                                                unsigned& bytesRead, struct sockaddr_in& fromAddressAndPort) {<br>
                Boolean result = Groupsock::handleRead(buffer, bufferMaxSize, bytesRead, fromAddressAndPort);<br>
                if (result) {<br>
                        // “fromAddressAndPort” is the sender’s IP address (and port number); record it<br>
                }<br>
<br>
                return result;<br>
        }<br>
<br>
Then, you would create your “RTPSource” object with an object of your “Groupsock" subclass, rather than with a regular “Groupsock”.<br>
<br>
Also:<br>
> RTCPInstance* rtcpInstance =<br>
>         RTCPInstance::createNew(*environment, &rtcpGroupSock, 5000, CNAME, NULL, rtpSource);<br>
<br>
Before doing this, you should call<br>
        rtcpGroupSock.changeDestinationParameters()<br>
with the sender’s IP address and port number, so that RTCP “RR” packets go back to the sender.  (And if you want to use “rtpGroupSock” to send audio back to the sender (via a “RTPSink” object), then you should call “changeDestinationParameters()” on “rtpGroupSock” as well.)<br>
<br>
<br>
Ross Finlayson<br>
Live Networks, Inc.<br>
<a href="http://www.live555.com/" rel="noreferrer" target="_blank">http://www.live555.com/</a><br>
<br>
<br>
_______________________________________________<br>
live-devel mailing list<br>
<a href="mailto:live-devel@lists.live555.com" target="_blank">live-devel@lists.live555.com</a><br>
<a href="http://lists.live555.com/mailman/listinfo/live-devel" rel="noreferrer" target="_blank">http://lists.live555.com/mailman/listinfo/live-devel</a><br>
</blockquote></div></div>