Haxe connection to SFS PRO [Urgent]

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

p0ff
Posts: 3
Joined: 03 Oct 2014, 16:27

Haxe connection to SFS PRO [Urgent]

Postby p0ff » 09 Oct 2014, 12:44

I'm working on a project in Haxe which requires a connection to the SmartFoxServer. I installed SFS Pro (localhost:8080 opens and displays the intro page fine). I haven't modified the config files either.

Client-side, I try running SmartFoxClient.connect([my ip], 9339);
After the line with connect, nothing runs and the listener SFSEvent.onConnection is never called. If someone has successfully connected to SFS in Haxe, please help.

Code: Select all

import it.gotoandplay.smartfoxserver.SmartFoxClient;
import it.gotoandplay.smartfoxserver.SFSEvent;
class New {
    public static function main() {
        var sfs = new SmartFoxClient(true);
        haxe.Log.trace(sfs.properties);
        sfs.addEventListener(SFSEvent.onConnection, function(e:SFSEvent) {
            haxe.Log.trace("Listener called: " + sfs.getConnectionMode);
            if(e.params.success) {
   
            haxe.Log.trace("Success");
                }
            else {
            haxe.Log.trace("Success");
                }
        });
        try{
                haxe.Log.trace("Connecting Started..");
                sfs.connect("192.168.1.229", 9339);  //my ip is 192.168.1.229 on the internal server.  Tried with "127.0.0.1" and got the same result
                haxe.Log.trace("Connecting...");
        }
        catch(e:String) {
                haxe.Log.trace("Failed");
        }
        haxe.Log.trace("Connection Sent..................");
    }
}


I compile with haxe -main New -swf whatever.swf -swf-lib SmartFoxClient.swf -swf-lib SFSEvent.swf
The compilation runs fine, but the output of the traces is only sfs.properties(which is null) and "Connecting Started.."

Note: it connectss fine in AS3, so I assume the problem is with the included swf-lib in haxe.

This is somewhat urgent as the project submission is in a few days.

Edit: I probably should have posted this thread in the client discussion. Sorry about that.
Rutter
Posts: 99
Joined: 12 Dec 2007, 16:21
Location: Canada
Contact:

Re: Haxe connection to SFS PRO [Urgent]

Postby Rutter » 09 Oct 2014, 21:33

Since you say it works in AS3, have you checked your server logs to see if there is any fault with the connection or does the server never see the connection attempt?
p0ff
Posts: 3
Joined: 03 Oct 2014, 16:27

Re: Haxe connection to SFS PRO [Urgent]

Postby p0ff » 10 Oct 2014, 08:53

The server never sees the connection attempt. The problem seems to be completely client-side.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Haxe connection to SFS PRO [Urgent]

Postby Lapo » 13 Oct 2014, 16:07

Can you reach the server via AdminTool?
If so, maybe the way in which you test could cause problem. E.g. the standalone flash player can fail silently if there are security errors. Try running in the browser instead.
Lapo
--
gotoAndPlay()
...addicted to flash games
p0ff
Posts: 3
Joined: 03 Oct 2014, 16:27

Re: Haxe connection to SFS PRO [Urgent]

Postby p0ff » 15 Oct 2014, 16:22

The admin tool was working fine. I forgot to give flash permission to use sockets... By adding it to a trusted folder, the problem was completely resolved. Thanks though.

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 52 guests