RTMFP Connection Tester

Having problems connecting RTMFP? Use this application to test NetConnection, NetStream, NetGroup connection and publishing status. For success connection, opened UDP ports in range 1024..65535 required. Run two instances to test NetGroup neighboring.


The code behind testing application:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:s="library://ns.adobe.com/flex/spark" 
    xmlns:mx="library://ns.adobe.com/flex/mx" 
    width="100%" height="100%" applicationComplete="init()">
<s:layout>
    <s:HorizontalLayout/>
</s:layout>
<fx:Script>
<![CDATA[
    import flash.net.navigateToURL;
    
    import org.osmf.net.NetConnectionCodes;
    import org.osmf.net.NetStreamCodes;
    private static const HANDSHAKE_URL:String = "rtmfp://stratus.rtmfp.net";
    private static const DEVELOPER_KEY:String = "PUT***YOUR***OWN";
    
    private var netConnection:NetConnection = new NetConnection();
    private var netStream:NetStream;
    private var netStream2:NetStream;
    private var netGroup:NetGroup;
    private var d0:Date
    
    private function init():void
    {
        d0 = new Date();
        netConnection.connect(HANDSHAKE_URL + "/" + DEVELOPER_KEY);
        netConnection.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
    }
    
    private function netConnectionConnected():void
    {
        var groupSpecifier:GroupSpecifier = new GroupSpecifier("somegruop");
        groupSpecifier.serverChannelEnabled = true;
        groupSpecifier.multicastEnabled = true;
        groupSpecifier.ipMulticastMemberUpdatesEnabled = true;
        groupSpecifier.postingEnabled = true;
        var groupspec:String = groupSpecifier.groupspecWithAuthorizations();
        
        netStream = new NetStream(netConnection, groupspec);
        netStream.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
        netStream2 = new NetStream(netConnection, groupspec);
        netStream2.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
        netGroup = new NetGroup(netConnection, groupspec);
        netGroup.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
    }
    
    private function onNetStatus(event:NetStatusEvent):void
    {
        var code:String = event.info.code;
        var time:Number = Math.round((new Date().time - d0.time)/10) / 100;
        log.appendText(code + " (" + time + " sec)\n");
        switch(code)
        {
            case NetConnectionCodes.CONNECT_SUCCESS:
                netConnectionCheckBox.selected = true;
                netConnectionConnected();
                break;
            case "NetStream.Connect.Success":
                if(event.info.stream == netStream)
                {
                    netStreamCheckBox.selected = true;
                    netStream.publish("test");
                }
                else if(event.info.stream == netStream2)
                {
                    netStream2.play("test");
                }
                break;
            case "NetGroup.Connect.Success":
                netGroupCheckBox.selected = true;
                break;
            case NetStreamCodes.NETSTREAM_PUBLISH_START:
                netStreamPublishCheckBox.selected = true;
                break;
            case NetStreamCodes.NETSTREAM_PLAY_START:
                netStreamPlayCheckBox.selected = true;
                break;
            case "NetGroup.Neighbor.Connect":
                netGroupNeighborCheckBox.selected = true;
                break;
        }
    }
    
    private function onReadMore():void
    {
        var url:String = "http://blog.yoz.sk/2010/06/quick-tip-ports-required-for-rtmfp/";
        navigateToURL(new URLRequest(url), "_blank");
    }
]]>
</fx:Script>
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:VGroup>
    <s:HGroup verticalAlign="middle">
        <s:CheckBox id="netConnectionCheckBox" enabled="false"/>
        <s:Label text="NetConnection" />
    </s:HGroup>
    <s:HGroup verticalAlign="middle">
        <s:CheckBox id="netStreamCheckBox" enabled="false"/>
        <s:Label text="NetStream" />
    </s:HGroup>
    <s:HGroup verticalAlign="middle" paddingLeft="10">
        <s:CheckBox id="netStreamPublishCheckBox" enabled="false"/>
        <s:Label text="NetStream.Publish" />
    </s:HGroup>
    <s:HGroup verticalAlign="middle" paddingLeft="10">
        <s:CheckBox id="netStreamPlayCheckBox" enabled="false"/>
        <s:Label text="NetStream.Play" />
    </s:HGroup>
    <s:HGroup verticalAlign="middle">
        <s:CheckBox id="netGroupCheckBox" enabled="false"/>
        <s:Label text="NetGroup" />
    </s:HGroup>
    <s:HGroup verticalAlign="middle" paddingLeft="10">
        <s:CheckBox id="netGroupNeighborCheckBox" enabled="false"/>
        <s:Label text="NetGroup.Neighbor" />
    </s:HGroup>
</s:VGroup>
<s:VGroup width="100%" height="100%">
    <s:TextArea id="log" width="100%" height="100%" text="For success connection, opened UDP ports in range 1024..65535 required.&#13;Run two instances to test NetGroup neighboring.&#13;" />
    <s:Button label="Read more about RTMFP requirements" click="onReadMore()"/>
</s:VGroup>
</s:Application>

Where to go from here:

3 comments so far

  1. […] RTMFP Connection Tester […]

  2. Eyal December 19, 2010 10:26

    I wanted to know in relation to opening the firewall,

    do i need to open the ports for a specific process?
    (like firefox, chrome, IE ?)
    I want to know as i am coding an Addon that may run on FF,IE,CH so
    each of them will need incoming UDP access separately.

    i wanted run an executable at installation time to enable of opening of all the relevant ports in the firewall.
    for now i am in the process of writing this for Windows Firewall.
    but most probably am looking to do the same for Macffee,Norton and AVG…

    drop me an email and i will send u back the code so you could include this on site.

    Eyal

  3. Jozef Chúťka December 20, 2010 10:55

    @Eyal, go through
    http://blog.yoz.sk/2010/06/quick-tip-ports-required-for-rtmfp/
    first make sure your ISP does not block it by disabling all firewals on your side, after you get connected succesfuly turn on the firewall again and make appropriate changes

Leave a comment

Please be polite and on topic. Your e-mail will never be published.