开发者

Red5 NetConnection Rejected

I wrote a simple application in Flash Builder supposed to work in the red5 server... However when i run the application the red5 server rejects the connection.... The event.info.code says "NetConnection.Connect.Rejected"...

I've tried changing Red5 versions (I've used version 0.6, 0.8 and 0.9) however nothing seems to work.. I've googled the error but it shows up no results...

Red5 installer doesnt seem to be able to connect to its server either.. It shows "NetConnection.Connect.Failed"... The logs show the following lines

2011-04-21 开发者_如何转开发22:08:02,469 [NioProcessor-1] INFO  o.r.s.a.MultiThreadedApplicationAdapter - W3C x-category:session x-event:connect c-ip:127.0.0.1 c-client-id:0

2011-04-21 22:08:02,479 [NioProcessor-1] INFO  o.r.s.a.MultiThreadedApplicationAdapter - W3C x-category:session x-event:disconnect c-ip:127.0.0.1 c-client-id:0

I've been stuck at this for a long time and can find no way out... I need to build a Flash application and cannot use Flash Media Server due to its cost...

My code is given below

<?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" minWidth="955" minHeight="600"
               creationComplete="init()">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <fx:Script>
        <![CDATA[
            import flash.events.NetStatusEvent;
            import flash.net.NetConnection;
            import flash.net.ObjectEncoding;

            import mx.controls.Alert;
            [Bindable]
            private var nc:NetConnection;

            public function init():void
            {
                writeText("init()");    
                nc=new NetConnection();
                    nc.objectEncoding=ObjectEncoding.AMF0;
                    writeText("init()");
                    nc.addEventListener(NetStatusEvent.NET_STATUS,netStatus);

                    writeText("init()");
                    nc.connect("rtmp://localhost/first",true);
                    writeText("init()");
                }

                private function netStatus(event:NetStatusEvent):void
                {
                    writeText("netstatus()");
                    writeText(event.info.code);
                    trace(event.info.code);
                    if(event.info.code == "NetConnection.Connect.Rejected")
                    {
                        Alert.show("Rejected madarchod");
                        writeText("reject");
                        trace(event.info.application);
                    }
                    if(event.info.code == "NetConnection.Connect.Success")
                    {
                        writeText("connect");
                    }
                }

            private function writeText(txt:String):void
            {
                txtHistory.text+=txt+"\n";
            }




        ]]>
    </fx:Script>

    <s:TextArea top="10" bottom="10" id="txtHistory" width="252" height="10" />


</s:Application>


I had strange errors like this when my own application was compiled with java7 but the server runs on java6. No errors on startup but connection allways rejected. You should really use the oflaDemo to be shure that the client works. With own applications you can make a lot of mistakes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜