Okay, server-side is ready, but we should test it somehow.


Create a new Actionscript project in Eclipse/Flex, and name it Red5FirstClient.

package
{

    import flash.net.NetConnection;
    import flash.net.ObjectEncoding;
    import flash.events.NetStatusEvent;
    import flash.display.Sprite;

    public class Red5FirstClient extends Sprite
    {

        private var nc:NetConnection;

        public function Red5FirstClient()
        {

            // new netconnection

            nc = new NetConnection( );

            // set encoding to old amf

            nc.objectEncoding = ObjectEncoding.AMF0;

            // netstatus event listening

            nc.addEventListener( NetStatusEvent.NET_STATUS , netStatus );

            // connect to red5, passing false as parameter

            nc.connect( "rtmp://localhost/firstapp" , false );

        }

        private function netStatus ( event:NetStatusEvent ):void
        {

            trace( event.info.code );

            if ( event.info.code == "NetConnection.Connect.Rejected" )
            {

                // trace reject message

                trace( event.info.application );

            }

        }

    }

}

Run menuitem -> Debug. Because we passed false as connection parameter, our red5 application will reject us, check the last line of red5/jvm log in terminal.

[INFO] 87028 pool-2-thread-8:( com.milgra.Application.appConnect ) Red5First.appConnect 1

so we were connected, let’s check the eclipse/flex console:

NetConnection.Connect.Rejected
you passed fals . . .
NetConnection.Connect.Closed

The server application rejected us, and it passed the rejection message also, it worked as we planned.

Let's change the connection parameter to true, and wonder happens:

nc.connect( "rtmp://localhost/firstapp" , true );

the result is:

NetConnection.Connect.Success

Our application is working!!!