iPhone / iPad lock button cause disconnection

Post here your questions about the Objective-C API for SFS2X

Moderators: Lapo, Bax

crosskid
Posts: 36
Joined: 30 Oct 2012, 07:56

iPhone / iPad lock button cause disconnection

Postby crosskid » 01 Feb 2013, 04:14

hello, this time i want to ask about smartfox connection / disconnection
when my apps running, then switch the view either by press home button or dragging multiple touch horizontally, the connections seems fine
but when i press the lock button, it goes disconnect (monitored in admin panel), then when i activate the apps, its goes to onConnectionLost:(SFSEvent *)evt with the event reason is unknown
what must i do to prevent this? at least when enter the background by pressing lock screen the smartfox connection still maintained.
thanks
haloyudi
Posts: 1
Joined: 04 Feb 2013, 08:52

Re: iPhone / iPad lock button cause disconnection

Postby haloyudi » 04 Feb 2013, 09:44

Hi,
Is there any information for above question? :D
Since I also have the same issue. I need to alter what is the default behaviour of smartfox server, to not automatically disconnected after any player/user comes back from switching the app or after going to the home view of the devices.

Thanks

Y
User avatar
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Re: iPhone / iPad lock button cause disconnection

Postby A51Integrated » 04 Feb 2013, 18:29

There are a few things that can be done. Play with the Zone reconnection time to make sure you have a good balance between keeping player's sessions active and not draining server resources unnecessarily. Second, you may need to detect when the app enters and leave the background, as explained here:

viewtopic.php?f=21&t=15262&start=15#p64430
A51 Integrated
http://a51integrated.com / +1 416-703-2300
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Re: iPhone / iPad lock button cause disconnection

Postby mmilen » 07 Feb 2013, 07:34

Here are some further observation.

Sane scenarion as from my previous post, but this time I press the Lock button when I'm in a room/game. When I swi to unlock everything is perfect , I see my Reconnecting and resume message and the game continues, users can come and go.

Now I leave the table, it is dissolved, and I want to create a new game/room. A room create extension is fired, all looks good , the room appears on server and everybody else sees it, and the Packet queue for the room creator starts to grow. The creator of the room does not receive any kind of data from the server, but it can send data no problem.
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Re: iPhone / iPad lock button cause disconnection

Postby mmilen » 07 Feb 2013, 08:57

Some info.

Server 1. Linux 2.6.18-308.13.1.el5PAE on i686 with 32 Bit SFS 2.0.1 patched to 2.5
Server 2. Linux 2.6.18-274.3.1.el5 on x86_64 with 64 Bit SFS 2.0.1 patched to 2.5

The same iOS APP will connect , Lock screen reconnect and send receive data with Server 1 but not with server Server 2.

That line is strange :
03:34:08,226 WARN [SocketWriter-1] core.SocketWriter - Could not OP_WRITE for Session: { Id: 6, Type: DEFAULT, Logged: Yes, IP: 135.19.72.208:51321 }, written bytes: 13032



This is what I get on the 64 bit machine

03:34:00,397 INFO [com.smartfoxserver.v2.controllers.SystemController-1] sessions.DefaultSessionManager - Session removed: { Id: 9, Type: DEFAULT, Logged: No, IP: 135.19.72.208:51321 }
03:34:00,399 INFO [com.smartfoxserver.v2.controllers.SystemController-1] sessions.DefaultSessionManager - Session was resurrected: { Id: 6, Type: DEFAULT, Logged: Yes, IP: 135.19.72.208:51321 }, using temp Session: { Id: 9, Type: DEFAULT, Logged: No, IP: 135.19.72.208:51321 }, 55
03:34:00,399 INFO [com.smartfoxserver.v2.controllers.SystemController-1] system.Handshake - Reconnected USER: ( User Name: Developer, Id: 0, Priv: 2, Sess: 135.19.72.208:51321 ) , logged: true
03:34:07,557 INFO [com.smartfoxserver.v2.controllers.ExtensionController-2] managers.SFSRoomManager - Room created: { Zone: SocialBridgeTables }, [ Room: Table: Developer, Id: 2, Group: default, isGame: true ]
03:34:08,226 WARN [SocketWriter-1] core.SocketWriter - Could not OP_WRITE for Session: { Id: 6, Type: DEFAULT, Logged: Yes, IP: 135.19.72.208:51321 }, written bytes: 13032
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Re: iPhone / iPad lock button cause disconnection

Postby mmilen » 07 Feb 2013, 19:17

And a little bit more info:

after the OP_WRITE error, if the client Locks and unlocks the device again, the resume is successful and the read write from to server start working normally.
User avatar
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Re: iPhone / iPad lock button cause disconnection

Postby A51Integrated » 07 Feb 2013, 20:58

Is the Java version on the server the same for both servers?
A51 Integrated

http://a51integrated.com / +1 416-703-2300
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Re: iPhone / iPad lock button cause disconnection

Postby mmilen » 07 Feb 2013, 22:12

On both it is the JRE that comes with the respective SFS installer for 32 and 64 bit architecture.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: iPhone / iPad lock button cause disconnection

Postby Lapo » 07 Feb 2013, 22:55

Hi,
unfortunately this goes beyond what we can put our hands on. It's actually weird and I agree that in theory it should work the same on both servers.
What is happening I can't say exactly.
That line is strange :
03:34:08,226 WARN [SocketWriter-1] core.SocketWriter - Could not OP_WRITE for Session: { Id: 6, Type: DEFAULT, Logged: Yes, IP: 135.19.72.208:51321 }, written bytes: 13032

In essence this is a network error that says that the server is not able to fully write the data from a buffer to the client, therefore it should register the client channel for an OP_WRITE. This is an event that is called back by the non-blocking selector when the client is ready to receive more data. When this event registration fails, it means that the connection is no longer valid.

It's actually very rare to see this error. I've seen it myself a couple of times.

Server 1. Linux 2.6.18-308.13.1.el5PAE on i686 with 32 Bit SFS 2.0.1 patched to 2.5
Server 2. Linux 2.6.18-274.3.1.el5 on x86_64 with 64 Bit SFS 2.0.1 patched to 2.5

What other differences there might be? Are they hosted in the same place?
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: iPhone / iPad lock button cause disconnection

Postby Lapo » 07 Feb 2013, 23:01

after the OP_WRITE error, if the client Locks and unlocks the device again, the resume is successful and the read write from to server start working normally.

Well, this makes sense. By locking/unlocking he's basically forcing a new socket to be created so it's getting out of troubles.
Lapo

--

gotoAndPlay()

...addicted to flash games
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Re: iPhone / iPad lock button cause disconnection

Postby mmilen » 07 Feb 2013, 23:10

I'm digging for underlaying network issue with the server.
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Re: iPhone / iPad lock button cause disconnection

Postby mmilen » 07 Feb 2013, 23:19

The other major difference is one is Intel (64 bit) and AMD (32 bit) .
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Re: iPhone / iPad lock button cause disconnection

Postby mmilen » 08 Feb 2013, 00:10

After digging around a bit more I have a question:

Why there is no problem with my 64 bit Server , when the client is in a room/game? It only happens with the client tries to create a game and 13K data is sent to it?

After resume any small message goes through OK.

But this 13K message is stuck dead :

07 Feb 2013 | 18:53:54,987 | WARN | SocketWriter-1 | bitswarm.core.SocketWriter | Could not OP_WRITE for Session: { Id: 21, Type: DEFAULT, Logged: Yes, IP: 135.19.72.208:53024 }, written bytes: 13032

Is there any code difference between 32 and 64 bit SFS server? Any uncheck buffer or something?
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Re: iPhone / iPad lock button cause disconnection

Postby mmilen » 08 Feb 2013, 04:31

It is shaping up to be the hardware. Something is not right with the NIC.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: iPhone / iPad lock button cause disconnection

Postby Lapo » 08 Feb 2013, 08:29

I see.
As regards your previous question, you probably misinterpreted the error message:
07 Feb 2013 | 18:53:54,987 | WARN | SocketWriter-1 | bitswarm.core.SocketWriter | Could not OP_WRITE for Session: { Id: 21, Type: DEFAULT, Logged: Yes, IP: 135.19.72.208:53024 }, written bytes: 13032

The 13K bytes were actually written to the socket but when it's time to register for the OP_WRITE event the selector is reporting a network error.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X iPhone / iPad / OSX API”

Who is online

Users browsing this forum: No registered users and 16 guests