Socket connection timeout problem

Post here your questions about the Flash / Flex / Air API for SFS2X

Moderators: Lapo, Bax

Post Reply
danielalbu
Posts: 9
Joined: 01 Apr 2014, 10:59

Socket connection timeout problem

Post by danielalbu »

Hi,
We are experiencing problems with connecting to the SmartFox server from certain computers,
It seems that the socket connection timeout is 5 seconds in the SmartFox AS3 API and cannot be configured like regular socket objects in AS3 (http://helpx.adobe.com/flash/kb/flash-p ... ction.html)

Is it possible to change the timeout of the socket?
It is crucial since we believe that the computers which experience these problems would be able to connect had the timeout been longer (and thus allowing the computers more time to connect)

Thank you in advance.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Socket connection timeout problem

Post by Lapo »

Since Flash Player 10, Adobe has added a way to control the socket timeout.
http://help.adobe.com/en_US/FlashPlatfo ... ml#timeout

You can try adding this line of code after the instantiation of the SmartFox class:

Code: Select all

import com.smartfoxserver.v2.kernel;
...
var sfs:SmartFox = new SmartFox()
sfs.kernel::socketEngine.socket.timeout = 5000
The value is expressed in milliseconds, according to Adobe's doc the default is 20 seconds. I wouldn't recommend using values < 3-4 seconds.
Lapo
--
gotoAndPlay()
...addicted to flash games
danielalbu
Posts: 9
Joined: 01 Apr 2014, 10:59

Re: Socket connection timeout problem

Post by danielalbu »

Thank you, Lapo
adnan
Posts: 4
Joined: 16 May 2016, 09:04

Re: Socket connection timeout problem

Post by adnan »

Guys,
Hope you are doing well.
Anybody solved this issue ?
I want to handle it in Unity Game.
Please guys give me a help.


Thanks,
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Socket connection timeout problem

Post by Lapo »

Then please start a new thread in the Unity section and explain what is the problem exactly and what API version you're using.
Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
shahidbits2012
Posts: 16
Joined: 09 Jun 2021, 07:23

Re: Socket connection timeout problem

Post by shahidbits2012 »

@lapo how can we specify the connection timeout in SFS Java Client?

We are observing that the players are keep on trying to connect to the server internally for a very long time and eventually disconnects.
We want to explicitly drop the connection when the user is not connected within X secs and try again.

Please help!
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Socket connection timeout problem

Post by Lapo »

@shahidbits2012: I've already replied to your other topic, let's keep the conversation in one place.
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply