9 Replies Latest reply on Mar 16, 2010 10:40 AM by Michael Thornburgh

    Does Stratus/RTMFP support P2P behind the same NAT/Router?

    jxpeck Level 1

      Does Stratus/RTMFP support peers behind the same NAT/Router?

      (such that both peers have the same public IP address)

       

      That is: if two computers (each running Flash) are behind the same NAT, and connect to Stratus to get peerID;

      do we expect they can connect p2p?

      Or will each one get/see just the public IP address:port of the other?

      My initial tests indicate that this scenario fails [ICMP Destination Unreachable (port unreachable)]

      Is this just a limitation of my local router? does this work for others?

      Does Status expect the local router to detect/decode/resolve this situation?

       

      If the solution requires 10.1 groups, is there support to detect/diagnose when/if the peer is on the same LAN?

        • 1. Re: Does Stratus/RTMFP support P2P behind the same NAT/Router?
          Michael Thornburgh Adobe Employee

          the two computers report their local (inside-NAT) addresses to Stratus.  if computers A and B are both behind the same NAT and A tries to connect to B, A will send packets to B's local (inside-NAT) addresses and the outside (public, derived) address, as well as request a "UDP hole-punch" intro via Stratus.

           

          if B has a firewall that requires a UDP hole-punch for direct communication with A, that won't be able to work because the observed address that Stratus will use for the intro/hole-punch request is the outside-NAT address.

           

          so check your UDP firewall settings on computer B.  i bet if you open up UDP on the computer's firewall, direct behind-NAT communication should work.

          1 person found this helpful
          • 2. Re: Does Stratus/RTMFP support P2P behind the same NAT/Router?
            Michael Thornburgh Adobe Employee

            communication would also succeed if your NAT supported "hair-pinning", although it wouldn't be the direct behind-NAT LAN communication that would be ideal.

            • 3. Re: Does Stratus/RTMFP support P2P behind the same NAT/Router?
              jxpeck Level 1

              Thanks for the info, sounds like RTMFP supports this, and hopefully the AFP code does the right thing.

              [so, officially, the original question is answered]

               

              Note: In one instance, i'm running two browsers on the same host,

              so even the inner/LAN addresses would be the same. Therefore, if A sends to B's inner/LAN address,

              the [Windows] OS network layer *should* recognize that and 'hairpin' without leaving the host, or crossing the firewall.

              (I say "should" because Unix generally does that, but I'll have to check to see about Windoze).

              [And such packets are probably invisible to Wireshark also, so how do i verify what's happening?

              oh sure, just reconfigure to boot Linux... ]

               

              So glad you explained that the client tries all three pathways; if it works as you say,

              then I can probably ignore the ICMP error from the local router (or, as you say, teach it to do the hairpin).

               

              Can you confirm that P2P will work between browsers (say Chrome to Firefox) on a single Windows host?

              [I really want to know if I'm failing because of network configuration or application code/error;

              at this point, I am able to correctly exchange the peerIds, and start the NetSteam.play,

              but the two sides do not appear to be exchanging audio/video]

              • 4. Re: Does Stratus/RTMFP support P2P behind the same NAT/Router?
                Michael Thornburgh Adobe Employee

                yes, it should work in loopback on your same computer.  but it'll be using the physical interface addresses, not the loopback address(es), so it *may* still go through your firewall even if it doesn't go out onto the LAN.

                • 5. Re: Does Stratus/RTMFP support P2P behind the same NAT/Router?
                  jxpeck Level 1

                  Using a second computer, I have confirmed that packets are sent to the inner/LAN addresses.

                  And if the Windows firewalls are disabled, then:

                  A burst of packets is exchanged with the peer at the expected time/place.

                  (and repeats a packet exchange every 20 seconds)

                  But the media is not streaming.

                  Notably, my client.onPeerConnect(stream:NetStream) is not being invoked.

                   

                  I see some forum comments about onPeerConnect; has that been fixed?

                  I am using:

                     var client:Object = new Object();

                     client.onPeerConnect = function(...){...};

                     peerStream.client = client;

                  That is suitably dynamic, no?

                  • 6. Re: Does Stratus/RTMFP support P2P behind the same NAT/Router?
                    Michael Thornburgh Adobe Employee

                    are you setting the client on the publishing side?

                     

                    the one-packet-each-direction-every-20-seconds should be keepalive traffic.  that suggests that a session came up between the two flash players.

                     

                    are you doing NetStream.publish("streamname") on the publishing side, and NetStream.play("streamname") -- the same stream name that's being published -- on the subscribe side?  and are you doing the publish on the new NetStream(nc, NetStream.DIRECT_CONNECTIONS) side and the play on the new NetStream(nc, peerID) side?

                    • 7. Re: Does Stratus/RTMFP support P2P behind the same NAT/Router?
                      jxpeck Level 1

                      First, I thank you for your continued support on this, it is very much appreciated.

                       

                      I'm confident that the nc to Stratus is set up correctly (as we do get the nearIDs correctly)

                      Likewise, the server that registers and exchanges the peerIds for a given call is working correctly

                      (we see the correct peerIds transmitted and used, and we see the correct IP:port destinations exchanging packets via wireshark)

                      The publisher creates peerStream = new NetStream(stratusConnection, NetStream.DIRECT_CONNECTIONS)

                      and attaches a client [per above];

                      The player creates peerStream = new NetStream(stratusConnection, pubrPeerId);

                      The trace logs confirm the that publisher does: peerStream.publish(stream_name)

                      and player does peerStream.play(stream_name);

                       

                      *** and now it works *** (well, once; sort of... high latency)

                       

                      Best guess: i'm upgrading code that also works for server-media;

                      and that code supplies the extra args for stream.play(stream_name, start, len, reset)

                      apparently, supplying the optional [server] args (name, -1, -1, 1) silently confuses the play.

                      Does that meet your expectations/understanding?

                       

                      By branching around that and using only .play(name) I have partial success.

                      • 8. Re: Does Stratus/RTMFP support P2P behind the same NAT/Router?
                        jxpeck Level 1

                        It even works on a single machine (yay!)

                        But it still has this huge 'latency';

                        When I start the play, the first frame immediately snaps up,

                        but then its frozen for ~50 seconds;

                        eventually, the player gets a NetStream.Buffer.Full

                        and starts playing (but still the 1minute delay)

                         

                        In the server-media case, i would set stream.buffertime = 0.100

                        Removing that, and we have interactive streaming!

                         

                        Thanks for your help!

                        • 9. Re: Does Stratus/RTMFP support P2P behind the same NAT/Router?
                          Michael Thornburgh Adobe Employee

                          if it takes 50 seconds for you to get NetStream.Buffer.Full, it sounds like you have stream.bufferTime set to 50 seconds.  if you set it to 0.0, you'll be in minimum-latency "live" mode, which should be very timely.