SmartFox server : Connecting to the server

After a very horrible experience of using Red5 recently i recently started exploring SmartFox server.Must say that the initial expression is excellent.Server configurations are easy and development is straight forward.Also there is extensive help available on smartFox website. And the best thing is server is that unlike Red5, smartfox is not limited to flash action script.You can connect it to through .net,java and today i even connected it through objective-C.

Here is simple tutorial on how to connect and make  connection to smartfox server.

1:Setting up connection String

   1: var ip = "10.1.1.143";

   2: var port = 9339;

   3: var zone = "simpleChat";

2:Creating connection

   1: //connect to server

   2: var smartfox:SmartFoxClient = new SmartFoxClient(true);

   3: smartfox.addEventListener(SFSEvent.onConnection, handleConnection);

   4: smartfox.connect(ip, port);

3:Handling connection event

   1: function handleConnection(evt:SFSEvent):void

   2: {

   3:         var ok:Boolean = evt.params.success;

   4:         if (ok)

   5:         {

   6:                 txt_window.text = "Connection succesfull!";

   7:                 trace("Connection succesfull!");

   8:         }

   9:         else

  10:         {

  11:                 txt_window.text = "Can't connect!";

  12:                 trace("Can't connect!");

  13:         }

  14: }     

And that’s all you need to do to make connection to server and get the success/fail event.

Advertisements

9 Responses to SmartFox server : Connecting to the server

  1. Pingback: SmartFox server : Connecting to the server | Tea Break

  2. seleena says:

    hello 🙂

  3. martymcfly says:

    welcome! 😉

  4. martymcfly says:

    hello

  5. martymcfly says:

    gh

  6. giulio says:

    wow

  7. serrewerw says:

    lolsdd

  8. martymcfly says:

    ghgh

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: