About Java API to simulate Openspace npc problem.

Post here all your questions related with SmartFoxServer Java API

Moderators: Lapo, Bax

ddk2
Posts: 23
Joined: 16 Feb 2009, 06:56

About Java API to simulate Openspace npc problem.

Postby ddk2 » 10 Jun 2009, 05:37

Hi, bax.
I just complete my npc find path problem with the bug fixed Java API.
but i find some new problem.
the java simulate npc sometimes will lost connect automatic.
And the java output "Connection Lost."

Zhulp
Best regards.
the Shinezone() team.
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 10 Jun 2009, 06:26

The server disconnects idle users after a certain amount of time.
This parameter is configurable via the <MaxUserIdleTime> setting in the config.xml

If you prefer you can send a "keep-alive" message from your NPCs by calling your server side extension, using a dummy message.
Lapo
--
gotoAndPlay()
...addicted to flash games
ddk2
Posts: 23
Joined: 16 Feb 2009, 06:56

Postby ddk2 » 10 Jun 2009, 06:30

what is the dummy message :?:
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 10 Jun 2009, 09:27

An empty request sent to your server side extension, with no data.
Lapo

--

gotoAndPlay()

...addicted to flash games
ddk2
Posts: 23
Joined: 16 Feb 2009, 06:56

Postby ddk2 » 11 Jun 2009, 03:24

Must be empty message?
i let my Java npc to find path per 60 seconds.
but my Java npc still will lost connecting "sometimes".
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 11 Jun 2009, 06:02

How did you set the <MaxUserIdleTime>?
As regards the empty extension message, I mean something like this:

java code:

Code: Select all

smartFox.sendXtMessage("gameExt", "ping", new SFSObject());

where smartFox is an instance of the SmartFoxClient class

This is sufficient to keep the user alive and on the server side you can completely ignore the request.
Lapo

--

gotoAndPlay()

...addicted to flash games
ddk2
Posts: 23
Joined: 16 Feb 2009, 06:56

Postby ddk2 » 11 Jun 2009, 07:12

I set the <MaxUserIdleTime>300</MaxUserIdleTime>.
And I think does Java API must send empty message to keep alive?
I mean the Java API to simulate NPC will lost connetion sometimes suddenly.
It looks like the sfs kick off the NPC User, or touch sfs kick itself which Java API make something wrong.
User avatar
Bax
Site Admin
Posts: 4608
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 11 Jun 2009, 08:54

ddk2,
your idle time is set to 300 seconds (MaxUserIdleTime config parameter). If your NPC doesn't send requests to SmartFoxServer within that time period, it gets disconnected.
In order to avoid a disconnection, you can send a fake request to your extension, just like in the Lapo's example.
Paolo Bax
The SmartFoxServer Team
ddk2
Posts: 23
Joined: 16 Feb 2009, 06:56

Postby ddk2 » 11 Jun 2009, 13:11

you mean I must send some message to Extend to keep the connection alive
And the NPC in Openspace which simulated by Java API send the path to move operate is 'can not to keep alive' message, course it dose not send to extends?
User avatar
Bax
Site Admin
Posts: 4608
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 12 Jun 2009, 06:13

Sorry, but I don't understand (for example, why do you say "extend"? the name is "extension").

Are you saying that your java client which simulates an NPC always sends a path to the users within the MaxUserIdleTime?
If no, this could be the reason for disconnection, because the NPC is idle.
If yes, then it shouldn't be disconnected, because when sending the new path to the other clients you are (I suppose) both setting the user variables and sending an object. These two are enough to keep the connection alive.
Paolo Bax
The SmartFoxServer Team
ddk2
Posts: 23
Joined: 16 Feb 2009, 06:56

Postby ddk2 » 12 Jun 2009, 07:02

bax wrote:Sorry, but I don't understand (for example, why do you say "extend"? the name is "extension").

Are you saying that your java client which simulates an NPC always sends a path to the users within the MaxUserIdleTime?
If no, this could be the reason for disconnection, because the NPC is idle.
If yes, then it shouldn't be disconnected, because when sending the new path to the other clients you are (I suppose) both setting the user variables and sending an object. These two are enough to keep the connection alive.


Yes, I mean the "extends" is the extension.
And I the npc send the new path to other clients is within idle time.
And I mean the npc will lost connection sometimes suddenly.
User avatar
Bax
Site Admin
Posts: 4608
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 12 Jun 2009, 07:23

It is quite impossible to understand which problem could cause this behavior... not enough clues.
Does the console on the server-side or client-side show any kind of error?
Paolo Bax
The SmartFoxServer Team
patso
Posts: 380
Joined: 13 Nov 2006, 13:44
Location: Sofia, Bulgaria

Postby patso » 12 Jun 2009, 08:54

btw you mention that it happens sometimes - is there any pattern? For example approximately same time or when you do action X but not always when you do it, etc.
ddk2
Posts: 23
Joined: 16 Feb 2009, 06:56

Postby ddk2 » 12 Jun 2009, 10:35

I find one way to course that:
Java simulate NPC in Openspace will lost connect when the room user who is the Client of swf all is left.
the Java simulate NPC will lost connection.

that is one way to touch.
And I think there is some other way to touch it.
patso
Posts: 380
Joined: 13 Nov 2006, 13:44
Location: Sofia, Bulgaria

Postby patso » 16 Jun 2009, 06:29

ddk2 wrote:I find one way to course that:
Java simulate NPC in Openspace will lost connect when the room user who is the Client of swf all is left.
the Java simulate NPC will lost connection.

that is one way to touch.
And I think there is some other way to touch it.


Can you explain a bit better or to provide the debug log. I've tried several tests with both java and swf clients and I was not able to reproduce issue where a java client is disconnected when swf client leaves the room.

Return to “Java2SE / Android Client API”

Who is online

Users browsing this forum: No registered users and 7 guests