Page 1 of 1

Can sfs support alreaddy made game ?

Posted: 18 Jun 2012, 13:08
by shravan.yadav

I woul like to know that can port any any game which are already developed in android or other plateform withsfs 2x ?
if yes then how can i do for the same. From where I can found the sfs 2x.jar for the use of sfs lib.Where I have to write the code for server side ? Please let me know how should i start ?I download the sfs 2x and install it. It is look like command promt .What is use of this ?


Re: Can sfs support alreaddy made game ?

Posted: 19 Jun 2012, 07:09
by Bax
What do you mean with "port"? If you think you just have to connect your existing game to SmartFoxServer and it becomes a multiplayer game out-of-the-box, then you are wrong. Games must be designed to be multiplayer. Of course you can convert an existing game, but it is not a matter of a few lines of code.
We strongly recommend that you read the documentation and check the examples. This will answer to most of your questions.

Re: Can sfs support alreaddy made game ?

Posted: 20 Jun 2012, 07:33
by shravan.yadav
Thanks for reply.

I have some confusion ,suppose I make a hello world application in android, now i want this application treat as a multiplayer game .what steps should be take for this ?
I have install the sfs2x in my machine and start it and using android sdk i made the hello word aplication .Now using sfs2x libreary am trying to connect to sfs2x but it is not happening .I am using SmartFox class for the connection.I am taking ip and port 9933 and also tried for localhost ip and 8080 port. Please help me . code:
package com.nextgen;

import com.smartfoxserver.v2.exceptions.SFSException;

import sfs2x.client.SmartFox;
import sfs2x.client.core.BaseEvent;
import sfs2x.client.core.IEventListener;
import sfs2x.client.core.SFSEvent;
import android.os.Bundle;
import android.util.Log;

public class HelloAndroidActivity extends Activity implements IEventListener {
/** Called when the activity is first created. */

SmartFox sfsClient;

public void onCreate(Bundle savedInstanceState) {
sfsClient = new SmartFox(true);
sfsClient.connect("",8080);// sfsClient.connect("",9933);
boolean b;

Log.v("Is Connected ", " "+b);

// Log.v("Shravan Tag for ",sfsClient.getCurrentZone());
// Log.v("Shravan Tag for ",sfsClient.getSessionToken());
// Log.v("Shravan Tag for ",sfsClient.getVersion());
Log.v("shravan tag",""+sfsClient.isJoining());
catch(Exception e){

Log.v("Shravan Tag", e.toString());
Log.v("shravan Tag:getStackTrace()", ""+e.getStackTrace());
Log.v("shravan Tag:getCause()", e.getCause().toString());
Log.v("shravan tag:getLocalizedMessage()", e.getLocalizedMessage().toString());
Log.v("Shravan Tag:getMessage(", e.getMessage());

private void initSmartFox()
// Instantiate SmartFox client
Log.v("Shravan Tag2", "this is tag2");

Log.v("Shravan Tag3", "this is tag3");
// Add event listeners
sfsClient.addEventListener(SFSEvent.CONNECTION, this);
Log.v("Shravan Tag4", "this is tag4");
sfsClient.addEventListener(SFSEvent.CONNECTION_LOST, this);
Log.v("Shravan Tag5", "this is tag5");
sfsClient.addEventListener(SFSEvent.LOGIN, this);
Log.v("Shravan Tag6", "this is tag6");
sfsClient.addEventListener(SFSEvent.ROOM_JOIN, this);
Log.v("Shravan Tag7", "this is tag7");
sfsClient.addEventListener(SFSEvent.HANDSHAKE, this);
Log.v("Shravan Tag8", "this is tag8");

// Displays the connect dialog box so the user can enter the server IP and port.


public void dispatch(BaseEvent arg0) throws SFSException {


Re: Can sfs support alreaddy made game ?

Posted: 20 Jun 2012, 13:39
by Bax
I'm sorry but we don't provide code reviews. Make sure you read the documentation and check the examples.

Re: Can sfs support alreaddy made game ?

Posted: 21 Jun 2012, 05:01
by shravan.yadav
Sorry for disturb you .........
I am not saying to reveiew my code . I just want to know that what ip address and port shoud be there for the sfs2x conection ?I am geting socketLayer error ?How should i solve this problem . I am running the given example only which is in doc .


Re: Can sfs support alreaddy made game ?

Posted: 21 Jun 2012, 09:07
by Bax
If you run the example on the same machine on which SFS runs, and if you didn't change the default SFS configuration, then you should connect to, port 9933

Re: Can sfs support alreaddy made game ?

Posted: 03 Jul 2012, 10:01
by ThomasLund
And running on a phone, you cannot!!! connect to, as that is local only. Need to change that on server and client side if you run it on your phone