Skip to main content
starmark02
Participant
May 4, 2010
Question

My app get close when I reject a connection from the server side =S Help

  • May 4, 2010
  • 1 reply
  • 431 views

Hi there,

     My app is having a rare behavior when I reject a connection from the server, I really dont understand why my AIR app get closed when I reject a connection from the server, I have in the client-side;

     var netConnecttion:NetConnection = new NetConnection();

          netConnecttion.client = this;

          netConnecttion.connect("rtmp://server/myapp/", user.text, pass.text);

When I run it, it normally connects to the server, in the server-side I Have;

application.onConnect = function (clientObj, user, pass ) {

     if (user == "root") {

            application.acceptConnection(clientObj);

        }

            else {

                application.rejectConnection(clientObj, {mensaje:"El usuario ya existe."});

            }

}


When the user is "root", my app's behavior is normal, but the problem is when the user is not "root", when isn't, I reject the connection, but I dont understand why the air application is closed completely.

When I remove the line where I reject the connection, My app does not close itself.


I need fix this,


Has this happened to someone ? Help me
    This topic has been closed for replies.

    1 reply

    May 5, 2010

    Hi,

    Actually when you use application.rejectConnection( ) on the server-side it is expected that on the client -side you would receive

    NetConnection.Connect.Rejected
    NetConnection.Connect.Closed

    What do you mean when you say your "AIR app closes completely"?

    It would help if you could explain a little more on what you are trying to achieve so I could help you.

    Thanks

    Mamata

    starmark02
    Participant
    May 5, 2010

    Hey thanks,


         I have fixed my problem, I had this line;


         netConnecttion.client = this;

    After to ;


        netConnecttion.connect ("rtmp:// .. ...");


    I mean I had ;


         netConnecttion.connect ("rtmp:// .. ...");

         netConnecttion.client = this;


    And it was causing the error, I removed the second line and I put it in the netStatusEvent when this return success

         NetConnection.Connect.Success


    I dont know if you understand what I mean, but it fixed my error,  wich was causing My app get Closed, just like I execute the close() method of the WindowedApplication;


    Thanks