Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Remoting / August 2005



Tip: Looking for answers? Try searching our database.

Remoting on Server Side

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kleva82 - 15 Aug 2005 14:40 GMT
Hi!
 I've got a problem when I'm trying to use remoting on server side of
Communication Server. For example I want to make authorization system. I've got
remote function getMyFunc which returns PASSED or FAILED. My Server Side Code
looks like:

////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////
load("netservices.asc");

application.onAppStart = function() {
    NetServices.setDefaultGatewayUrl("http://myHost/gateway.php");
    this.gatewayConnection = NetServices.createGatewayConnection();
}

function TestResult(client) {
this.client = client;
}

TestResult.prototype.getMyFunc_Result = function(res) {
    application.authResult = res;
    trace("Result:" + res);
}

function CheckUser(Username, Password) {
    var myService = application.gatewayConnection.getService("test",
                new TestResult(this));
    myService.getMyFunc(Username, Password);   
    trace("CheckUser Result: " + application.authResult);
    return application.authResult;
}   
   
application.onConnect = function(clientObj,userType, Username, Password) {
    trace("application.authResult = " + application.authResult);
    application.authResult = "FAILED";
    if (CheckBroadcastUser(Username, Password) == "PASSED")
        application.acceptConnection(clientObj);
    else application.rejectConnection(clientObj);
}

////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////

The problem is, that this script always will reject the connections! The
problem is, that in code
    myService.getMyFunc(Username, Password);   
    trace("CheckUser Result: " + application.authResult);
    return application.authResult;
getMyFunc executes for few second (just becouse it is remoting call), and
Flash Interpretator just DON"T wait while it executes and continue working.
Thats why it just returns "FAILED" all times.
In few seconds after reject was done in AppInspector I'll see the "Result:
PASSED" - but it is too late!!!!!!!!

How can I slove this problem? Is it possible to hold executing remote function
for a while?
Stefan Theusner - 19 Aug 2005 17:21 GMT
Hi,

flash send the request to the server but will never wait for the result.
 flash proceed with the code after your 'myService.getMyFunc(Username,
Password)' invokation.

Flash uses the _Result method in your object to pass the server result
by. So you have to continue in this method with your depending
application code.

It is not recommended to "stop" the whole application while waiting for
the server result.

The same applies to XML.sendAndLoad.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.