2 Replies Latest reply on Mar 28, 2013 9:27 AM by janpesek

    Windows 7 firewall problem

    janpesek Level 1



      I'm trying to develop a test application for P2P communication via Cirrus and came up to following problem with my Windows 7 firewall:


      How is my app designed to work: The application generates key (initConnection) on one side, then I manually copy the key to the other machine and connect again. Init send stream and receive stream on both of them should make the communication available. Whole code is attached below, it's just some sample code I downloaded somewhere for testing purposes.

      #edit: you can check working copy of the application here: http://peskovi.cz/p2ptest/P2Pplugin.html


      My setup: I've got two computers in my local network (connected through cable to same switch), Windows and Linux. However it seems I'm having the same trouble connecting to distant computers as swell.


      My problem: It seems that Windows 7 is partially blocking my connection. The thing is, when I init the connection on Windows and then copy the generated code to Linux and connects there, connection's not working at all. However, when I do it the other way (init on Linux and copy generated code to Windows), everything works just fine. Also, when I turn off firewall on my Windows it works fine both ways too. I have several reasons to believe there might be something wrong with my app:

      1) The sample app on Adobe Labs (http://labs.adobe.com/technologies/cirrus/samples/) works just fine both ways.

      2) RTMFP should be bidirectional protocol right? Doesn't make a lot of sense to me, why would I be able to connect to existing connection, but I wouldn't be able to start a new connection? That should pretty much use the same resources (ports), shouldn't it?

      3) If this is just a common thing with Windows 7, it would mean Cirrus is pretty much unusable for me, but I haven't seen any posts about this anywhere, which is suspicious.


      I'm new to AS/Cirrus/flash so there might be something really noobie I'm missing, so I'd be very glad if there would be someone wiling to help me with any hints why is it not working, what should I do, or just explain to me that I have to deal with the fact that it simply cannot be done and (mainly) why.


      Thank you very much,



      My application code:

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">



                  private const SERVER_ADDRESS:String = "rtmfp://p2p.rtmfp.net/";

                  private const DEVELOPER_KEY:String = "key";


                  private var nc:NetConnection;

                  private var myPeerID:String;

                  private var farPeerID:String;

                  // streams

                  private var sendStream:NetStream;

                  private var recvStream:NetStream;


                  private function initConnection():void{


                          farPeerID = txtFingerprint.text;



                      nc = new NetConnection();





                  private function ncStatus(event:NetStatusEvent):void{



                      myPeerID = nc.nearID;


                      txtFingerprint.text = myPeerID;



                  private function initSendStream():void{



                      sendStream = new NetStream(nc,NetStream.DIRECT_CONNECTIONS);

                      sendStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);



                      var sendStreamClient:Object = new Object();

                      sendStreamClient.onPeerConnect = function(callerns:NetStream):Boolean{


                          farPeerID = callerns.farID;


                          trace("onPeerConnect "+farPeerID);


                          return true;



                      sendStream.client = sendStreamClient;




                  private function initRecvStream():void{

                      recvStream = new NetStream(nc,farPeerID);




                      recvStream.client = this;



                  public function receiveSomeData(str:String):void{

                      txtReceiveData.text = str;



                  private function sendSomeData():void{




                  private function netStatusHandler(event:NetStatusEvent):void{





          <mx:TextInput x="10" y="10" width="391" id="txtFingerprint"/>

          <mx:Button x="409" y="10" label="Connect" click="initConnection()"/>

          <mx:TextInput x="10" y="40" id="txtSendData"/>

          <mx:TextInput x="10" y="70" id="txtReceiveData" width="251"/>

          <mx:Button x="178" y="40" label="Send data" click="sendSomeData()"/>

          <mx:Button x="10" y="100" label="initSendStream" click="initSendStream()"/>

          <mx:Button x="132" y="100" label="initReceiveStream" click="initRecvStream();"/>

          <mx:Text x="10" y="130" text="Hint: First running Flash app - click Connect to get Fingerprint PeerID. Copy and paste this PeerID to second running Flash app to the same field and click Connect. Then initSendStream and initReceiveStream on both of them and finally you can write some text and click Send data." width="391" height="122"/>



        • 1. Re: Windows 7 firewall problem
          Michael Thornburgh Adobe Employee

          if both peers are behind the same NAT *and* the peer to which you're connecting has a firewall that requires an outbound UDP packet to a specific IP address+port to allow packets to come in from that address+port, then simple P2P might not work with RTMFP unless you try to open the connection from both sides simultaneously.  that's what VideoPhoneLabs does.

          • 2. Re: Windows 7 firewall problem
            janpesek Level 1

            Hmm, not sure I completely understand now. What exactly simultaneously should mean in this context? The thing is that it seems there's no chance in getting the connection to work when I first turn on the client on my Windows computer. The other way (starting on my Linux computer) it works just fine, and I am able to connect from my Windows to my Linux anytime.


            Also I'm not sure that this is the problem, cause it seems that same problem apply to connection to other computers as well (however this impression is based on a testing with just a very few tries, so I'll try to test it more soon).


            Thanks for the explaining anyway!