Hi,
I'm implementing some retry mechanism that reconnects to SFS after a disconnection (regardless of HRC).
Most of the times it works very well, but few times already I've encountered an exception (func -onSmartfoxException delegates) after the connect call:
exception.name: NSRangeException
exception.reason: *** -[NSConcreteMutableData getBytes:range:]: range {22, 77} exceeds data length 35
dataDump:
dataDump [size=358]:
Data Read: Binary Size: 80
80 00 4d 12 00 03 00 01 61 03 00 00 00 01 63 02 ..M.....a.....c.
00 00 01 70 12 00 03 00 02 74 6b 08 00 20 38 35 ...p.....tk...85
36 37 32 36 36 65 30 37 38 36 65 36 37 38 63 38 67266e0786e678c8
37 31 65 36 37 37 30 65 33 35 63 66 62 32 00 02 71e6770e35cfb2..
63 74 04 00 00 04 00 00 02 6d 73 04 00 00 27 10 ct.......ms...'.
Any help would be appreciated. Also - do you think a few seconds delay between the disconnection and the connect attempt might solve this?
Thanks,
Eyal Barak
iOS SFS NSRangeException
Re: iOS SFS NSRangeException
Hi,
yes definitely, you should delay the reconnection by 500-1000ms minimum.
Also keep in mind that you need to recreate the main SmartFox object for a new connection.
Other than that you should be fine.
Cheers
yes definitely, you should delay the reconnection by 500-1000ms minimum.
Also keep in mind that you need to recreate the main SmartFox object for a new connection.
Other than that you should be fine.
Cheers
Re: iOS SFS NSRangeException
I actually didn't realize i need to recreate the object..
Why is that?
Just to clarify, currently the order of actions is (on client side):
- init - allocating the sfs object
- connect with some ip and port
- login with some token (userName) , pass and zone
- few more inhouse stuff
After the disconnection (onConnectionLost) -
- now wait 500-1000ms
- connect with SAME IP AND PORT
- login with NEW token (userName)
- few more inhouse stuff
Thanks!
Eyal
Why is that?
Just to clarify, currently the order of actions is (on client side):
- init - allocating the sfs object
- connect with some ip and port
- login with some token (userName) , pass and zone
- few more inhouse stuff
After the disconnection (onConnectionLost) -
- now wait 500-1000ms
- connect with SAME IP AND PORT
- login with NEW token (userName)
- few more inhouse stuff
Thanks!
Eyal
Re: iOS SFS NSRangeException
Yes the flows looks correct.
Why do you have to recreate the object?
That's just how the API work across all supported platforms.
cheers
Why do you have to recreate the object?
That's just how the API work across all supported platforms.
cheers
Re: iOS SFS NSRangeException
So I'm confused because the flow doesn't include re-init of object, and you still said it looks ok.. so guess it's not?
And bottom line as a rule of thumb, any connect() should actually be made on a new object?
Thanks,
Eyal
And bottom line as a rule of thumb, any connect() should actually be made on a new object?
Thanks,
Eyal
Re: iOS SFS NSRangeException
Sorry I should have tried to explain this better.
I would simply add one step in the flow you posted earlier:
Yes.
Hope it helps
I would simply add one step in the flow you posted earlier:
After the disconnection (onConnectionLost) -
- now wait 500-1000ms
- create new SmartFox2XClient instance
- connect with SAME IP AND PORT
- login with NEW token (userName)
- few more inhouse stuff
And bottom line as a rule of thumb, any connect() should actually be made on a new object?
Yes.
Hope it helps
Return to “SFS2X iPhone / iPad / OSX API”
Who is online
Users browsing this forum: No registered users and 42 guests