returnValues little issue

Options
sebako
edited June 2011 in DotNet
Hey guys,

I have a small issue with the returnValues I am getting from my server.
I build a Dictionary like this:
public Dictionary<short, object> getServerList
        {
            get 
            {
                Dictionary<short, object> list = new Dictionary<short, object>();

                // fields we wanna read
                String[] fields = dbConnection.HKeys("server_1");

                String[] returnValues;

                // read data for each server
                // if we add servers i < 6 needs to be adjusted accordingly
                for (int i = 1; i < 6; i++)
                {
                    returnValues = dbConnection.HMGet("server_"+i, fields);
                    list.Add((short)i, returnValues);
                }
                return list;
            }
        }


which will return servers 1-5 with the according fields from the database.
server_1 name, type etc.
server_2 name, type etc.

and so on

in my peer I send them back to the server within the operationRequest like this:
ServerList list = new ServerList();
            Dictionary<short, object> data = new Dictionary<short, object>();
            data = list.getServerList;

            return new OperationResponse((short)OperationCode.ServerList, (int)ErrorCode.Ok, "OK", operation.OperationRequest.InvocationId, Reliability.Reliable, (byte)0, data);


they are send back and on the client I am trying to catch them, where the issue comes in:
if (returnCode == (int)ErrorCode.Ok)
        {
            string[] data = (string[])returnValues[(byte)1];

            Debug.Log(data);
        }

in returnValues[(byte)1] I get "OK" however
I get only servers in byte 2-5 but one server is missing from the list. Looks like its cutoff somewhere but I cannot see where.
Any Ideas what might be wrong?

Any help is appreciated.

Thanks in advance.

-Seb

Comments

  • sebako
    Options
    Okay the Application log told me why the Value in returnValues[(byte)1] is removed from the list:

    2011-06-26 02:23:24,493 [16] WARN Photon.SocketServer.PhotonPeer [(null)] - SendOperationResponse - removed forbidden parameter 1 from operation response 102

    so thats basically the reason. Changing the Dictionarys Key to 2+ it worked. Is it noted anywhere that parameter 1 is forbidden in dictionarys send back from the Server? If not it would be useful if it would be noted/documented somewhere :)

    Anyway if someone falls into this pit, here is the solution.

    Cheers

    -Seb
  • Tobias
    Options
    Is it noted anywhere that parameter 1 is forbidden in dictionarys send back from the Server?
    Yes, somewhere I saw this documented. Obviously this is not as prominent as it should be.
    Parameters "ReturnCode" 0, "DebugString" 1 and Operation "Code" 60 are used in all Operation Results. We want to clean this up in a upcoming release but this will also break compatibility with current clients.
  • sebako
    Options
    yeah I enabled log4net which was displaying the error and the rest was easy.
    probably a good idea to update the documentation on the dev page to outline stuff like this a little bit better,
    but I can imagine that you are working on that as well. :=) Something like do's and dont's would fit for a topic like this imo.