i try to send some float to serve like:
Code: Select all
std::string* stdRequest = new string("updatePos");
ISFSObject * param = new SFSObject( );
std::string* stdKey = new string("pos");
vector<float*>* playerpos = new vector<float*>();
float pos[3];
pos[0] = 1.0;pos[1] = 2.0;pos[2] = 3.0;
playerpos->push_back(pos);
playerpos->push_back(pos+1);
playerpos->push_back(pos+2);
param->PutFloatArray(stdKey,playerpos);
long int testint[3];
testint[0] = 1;testint[1] = 2;testint[2] = 3;
vector<long int*>* playerIds = new vector<long int*>();
playerIds->push_back((long int *)testint[0]);
playerIds->push_back((long int *)testint[1]);
playerIds->push_back((long int *)testint[2]);
std::string* stdKeyName = new string("testint");
param->PutIntArray(stdKeyName,playerIds);
mSmartFox->Send( new ExtensionRequest(stdRequest,param,mMatchRoom) );
and i reieve it at serve:
Code: Select all
public void handleClientRequest(User user, ISFSObject params)
{
// Get position
Collection<Float> position = params.getFloatArray("pos");
Collection<Integer> testint= params.getIntArray("testint");
trace("position: " + position + " id: " + testint);
}
i got "poisition: [0.0,0.0,0.0] id: [1,2,3]"
is something wrong in my code?
i try playerpos->push_back((float *)pos[0]) like testint, but error when compile.