Login request response is different from the C++ API

Post here your questions about the C++ API for SFS2X

Moderators: Lapo, Bax, MBagnati

Antoniocide
Posts: 7
Joined: 06 Nov 2013, 11:31

Login request response is different from the C++ API

Postby Antoniocide » 15 Nov 2013, 09:17

Hi,

I was trying to make a login to a server already working. When I get the response of the server to the LoginRequest I have 2 params "data" and "reason" instead of "data" and "user" that says the C++ API:
http://docs2x.smartfoxserver.com/api-do ... 9ab851b559

Also, there is a problem when I try to access to the "data" content, because I get the game crashed with the following error:
Assertion failed: (px != 0), function operator->, file /Users/ramon/Desktop/boostoniphone-master/framework/boost.framework/Headers/smart_ptr/shared_ptr.hpp, line 424.

The code I use to retrieve the information of the LoginRequest response is this:
boost::shared_ptr<map<string, boost::shared_ptr<void> > > ptrEventParams = ptrEvent->Params();
boost::shared_ptr<void> ptrEventParamValueData = (*ptrEventParams)["data"];
boost::shared_ptr<SFSObject> ptrValue = (boost::static_pointer_cast<SFSObject>)(ptrEventParamValueData);

Thank you very much.
MBagnati
Posts: 125
Joined: 12 Feb 2013, 10:57

Re: Login request response is different from the C++ API

Postby MBagnati » 18 Nov 2013, 10:40

Hi,
To investigate the issue, I have done a login using the SimpleChat sample.

SimpleChat subscribes the login event by CMainFrame::InitializeSmartFox method contained into MainFrm.cpp
(see attached image Image01.png)

When the login event is fired, the registered listener OnSmartFoxLogin is called.
I have set a breakpoint in this method and using the debugger I have verified that the notified event contains information about "data", "user" and "zone"
(see attached image Image02.png)

So, by adding few rows into OnSmartFoxLogin I can retrieve information about logged-in user and associated zone, whereas data section is meaningless for this operation
(see attached image Image03.png)

Please, can you check the same pattern in your context?
Attachments
Image03.png
(160.89 KiB) Not downloaded yet
Image02.png
(62.54 KiB) Not downloaded yet
Image01.png
(39.03 KiB) Not downloaded yet
Antoniocide
Posts: 7
Joined: 06 Nov 2013, 11:31

Re: Login request response is different from the C++ API

Postby Antoniocide » 26 Nov 2013, 10:18

Thank you for your response, I managed to get time to check it and it worked well the SimpleChat sample. After that, I asked to the person who set up the server and he told me that there was a restriction to Log in with the password, so the response was wrong because the restriction of the password was not acomplished.

I am sorry for the trouble.

Return to “SFS2X C++ API”

Who is online

Users browsing this forum: No registered users and 2 guests