Client connection in the expansion

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

sasha55555
Posts: 4
Joined: 25 Apr 2016, 19:32

Client connection in the expansion

Postby sasha55555 » 07 Sep 2020, 17:59

Hello, the client is trying to connect to the server, so it creates a session:

Code: Select all

Session created: { Id: 30, Type: DEFAULT, Logged: No, IP: 127.0.0.1:52295 } on Server port: 9933 <---> 52295


But after a while the connection timeout is triggered in the client and it is disabled

Code: Select all

Session removed: { Id: 30, Type: DEFAULT, Logged: No, IP: 127.0.0.1:52295 }


In other words, the client did not can connect to the server during the timeout. So I don't understand why the client can't connect to the server. I'm using a new extension:

Code: Select all

public class MyExtension extends SFSExtension
{
    @Override
    public void init()
    {
        trace("Hello, this is my first SFS2X Extension!");
     
        // Add a new Request Handler
        addRequestHandler("connection", ReqHandler.class);
    }
   
    public class ReqHandler extends BaseClientRequestHandler
    {
        @Override
        public void handleClientRequest(User sender, ISFSObject params)
        {
           trace("CONNECT!!");
        }
    }
}


How do I approve a client connection in the extension so that client can start sending requests? Or is it for another reason?
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Client connection in the expansion

Postby Lapo » 08 Sep 2020, 09:05

Hi,
a client can send Extension requests only after having connected and logged into a Zone.
It seems like you're skipping the second step, logging into the Zone.

How do I approve a client connection in the extension so that client can start sending requests? Or is it for another reason?

Connections cannot be approved. They are necessary for communication between client and server and they are not based on a credential check mechanism. So there is nothing to approve.

Logins can be approved, though. This phase is where the client sends a username and a password and you can decide with your custom code to accept or refuse the access.

For more details on connections and logins please check the docs here:
http://docs2x.smartfoxserver.com/Develo ... tion-phase

To learn more about custom login code, check this article:
https://smartfoxserver.com/blog/how-to- ... tom-login/

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
sasha55555
Posts: 4
Joined: 25 Apr 2016, 19:32

Re: Client connection in the expansion

Postby sasha55555 » 08 Sep 2020, 11:29

It seems like you're skipping the second step, logging into the Zone.

How do I choose a zone to connect to, or do I want it to be selected automatically when I connect? I'm in the client trying to connect to the server:

Code: Select all

connect(ipAdr,port);
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Client connection in the expansion

Postby Lapo » 08 Sep 2020, 12:50

If you have checked the article I've linked:
http://docs2x.smartfoxserver.com/Develo ... tion-phase

You should see that in the left side menu, the next article in the list is about the login phase.

Check that as well.
Lapo

--

gotoAndPlay()

...addicted to flash games
sasha55555
Posts: 4
Joined: 25 Apr 2016, 19:32

Re: Client connection in the expansion

Postby sasha55555 » 08 Sep 2020, 15:23

Code: Select all

<msg t='sys'><body action='verChk' r='0'><ver v='156' /></body></msg>

I send this XML to the server, what does it mean?
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Client connection in the expansion

Postby Lapo » 08 Sep 2020, 15:30

That's an XML message that may have something to do with SmartFoxServer 1.x, but this section of the forum is dedicated to SmartFoxServer 2X which does not use an XML protocol.

It's really not clear what you're trying to do.
Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Baidu [Spider] and 114 guests