SocketDataError problem!

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

Moderators: Lapo, Bax

leid84
Posts: 3
Joined: 14 Feb 2012, 10:23

SocketDataError problem!

Postby leid84 » 14 Feb 2012, 10:58

Everytime I login into the zone, join in a room, wait for a while, the error comes out.

## SocketDataError: [ProgressEvent type="socketData" bubbles=false cancelable=false eventPhase=2 bytesLoaded=3 bytesTotal=0]

I've no idea where it comes from, I don't have large data to transfer. I can neither send message nor receive, seems like I'm disconnected. But I check the Zone Monitor module, it shows I am still in the room.
leid84
Posts: 3
Joined: 14 Feb 2012, 10:23

Postby leid84 » 14 Feb 2012, 11:01

I'm using SFS RC3, AS3, Java extension.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 14 Feb 2012, 23:11

Hi.

Does that happen every time you try to login? If so, can you provide us the code you're using for doing the login (specially the server-side part)?
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
leid84
Posts: 3
Joined: 14 Feb 2012, 10:23

Postby leid84 » 15 Feb 2012, 03:40

Yes, almost everytime. Here is server-side code, I just did a simple password validation.

Code: Select all

public class LoginEventHandler extends BaseServerEventHandler{
    private static final String seed = "xxxx";
   
    @Override
    public void handleServerEvent(ISFSEvent event) throws SFSException{
        if(event.getType() == SFSEventType.USER_LOGIN){
            SFSObject params = (SFSObject)event.getParameter(SFSEventParam.LOGIN_IN_DATA);
            long hnumber =  params.getLong("hnumber");
            String user_name = params.getUtfString("userName");
            String user_id = (String)event.getParameter(SFSEventParam.LOGIN_NAME);
            String password = (String) event.getParameter(SFSEventParam.LOGIN_PASSWORD);
            Session user_session = (Session)event.getParameter(SFSEventParam.SESSION);

            if(!getApi().checkSecurePassword(user_session, pwd_digest, password)){
                SFSErrorData errData = new SFSErrorData(SFSErrorCode.LOGIN_BAD_PASSWORD);
                throw new SFSLoginException("invalid user!", errData);
        }
      }
  }

}


Here is the client-side:

Code: Select all

public function login(iAuthenticationSystem:IAuthenticationSystem):void{
            var as_Login:AS_Login = (iAuthenticationSystem as AS_Login);
            (this.m_login = as_Login);
            (this.m_user = as_Login.User);
            var password:String = as_Login.Password;
            var params:SFSObject = as_Login.Params;
            var loginRequest:LoginRequest = new LoginRequest(this.m_user.Id, password, this.zone, params);
            try {
                this.sfs.send(loginRequest);
                (this._isLoggingOut = false);
            } catch(e) {
            };
        }


Actually, At first few minutes, I can send and receive message normally. And then I found that I can only send message out, but I can't receive it myself! And I can't not receive any message when this happend. others in the room can see my message.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: SocketDataError problem!

Postby rjgtav » 15 Feb 2012, 22:44

Hi,

You check the user's credentials against a database, correct? If so, please make sure that you always close the database connection after you get the password, even when you throw the LoginException.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
User avatar
copet80
Posts: 42
Joined: 27 Apr 2010, 22:23
Location: Australia
Contact:

Re: SocketDataError problem!

Postby copet80 » 06 Aug 2012, 02:04

We also experienced this problem, but now we couldn't investigate what was going on as we could no longer reproduce it. The symptoms were very similar:
1. Login to the game
2. Idle for 2-3 minutes
3. Everyone else in the room stops moving / talking
4. Console reports SocketDataError:

## SocketDataError: [ProgressEvent type="socketData" bubbles=false cancelable=false eventPhase=2 bytesLoaded=57 bytesTotal=0]
SocketClient: Socket error: [SFSEvent type="socketError" bubbles=false cancelable=false eventPhase=2 params=[object Object]]
[SFS - INFO] Data Read: Binary Size: 60
80 00 39 12 00 03 00 01 61 03 00 0C 00 01 63 02 ..9.....a.....c.
00 00 01 70 12 00 02 00 01 75 04 00 00 41 CC 00 ...p.....u...A..
02 76 6C 11 00 01 11 00 03 08 00 0B 73 71 75 61 .vl.........xxxxxxxx.....

At a glance it seemed like it was caused possibly by network fluctuation, but again because it only happened that time we can't tell for sure. I'll keep an eye on it and post an update if there's anything.

I'm keen to hear if anyone else has experienced this as well.
User avatar
Lapo
Site Admin
Posts: 21726
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SocketDataError problem!

Postby Lapo » 07 Aug 2012, 08:57

@copet80
Are you using the latest 2.2.0? If not please update
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
copet80
Posts: 42
Joined: 27 Apr 2010, 22:23
Location: Australia
Contact:

Re: SocketDataError problem!

Postby copet80 » 10 Aug 2012, 00:26

Thanks. We're in the process of updating to 2.2.0. From the release notes it seems like the following line is related to this issue?
[FIX] Improved buffering strategy for highly fragmented traffic.

If so, do you mind telling us any information about the issue and what was fixed so that we can perform some tests and observe if the issue has been solved for us after patching it on our production server.
User avatar
Lapo
Site Admin
Posts: 21726
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SocketDataError problem!

Postby Lapo » 10 Aug 2012, 07:31

I am sorry, no these problems are not reproducible at will. All I can say is that all people who previously reported issues like this confirmed that the issue no longer appeared.
We were able to see the problem randomly appear in each test prior to the patch, after it the problem is gone.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Aldenea, DavinVicy, DerikFent, Kevengar and 29 guests