sending unique strings via OpCustom.

Options
I am looking to send unique strings of numbers ranging anywhere from 1 to 8 characters via opcustom to the server. I am able to get the OpCustom to the server, but when it replies it does not send back the original string so I am not sure if it's never making it to the server or where the issue is in my code. I tried referencing the method that is used to send the room names (unique strings) to the server and back to client. Any help resolving my issues with this would be greatly appreciated. I'm having issues wrapping my head around it.

Client side method that is sent to the server...

public bool OpGetCampInfo(string campNumber)
{
if (this.DebugOut >= DebugLevel.INFO)
{
this.Listener.DebugReturn(DebugLevel.INFO, "OpRaiseEvent()");
}
Dictionary<byte, object> opParameters = new Dictionary<byte, object>();
opParameters[ParameterCode.CampNumber] = campNumber;


return this.OpCustom ((byte)OperationCode.GetCampInfo, opParameters, true, 0);



Server side response....

case OperationCode.GetCampInfo:
{
string campNumber = (string)operationRequest.CampNumber;
var data = new Dictionary<byte, object>;
data[ParameterCode.CampNumber] = (string)campNumber;
data[ParameterCode.CampStatus] = (string)"1";
sendParameters[ParameterCode.CampNumber] = (string)campNumber;
sendParameters[ParameterCode.CampStatus] = (string)"1";
var response = new OperationResponse(OperationCode = operationReqest.OperationCode, ReturnCode = 0, "OK", data);
response[ParameterCode.CampNumber] = (string)campNumber;
response[ParameterCode.CampStatus] = (string)"1";
this.SendOperationResponse(response, sendParameters);
break;


and finally the response from the client...



case OperationCode.GetCampInfo:
{// OK
string campStatus = (string)operationResponse[125];
string campNumber = (string)operationResponse[150];
Debug.Log (campStatus);
Debug.Log(campNumber);
Debug.Log ("i made it - networking peer");
if (operationResponse.ReturnCode == 0)
{
// show the complete content of the response
Debug.Log("Successful transmission - photon handler");
}
else
{
// show the error message
Console.WriteLine(operationResponse.DebugMessage);
}
break;





}

Comments

  • Tobias
    Options
    First of all you should take a look at the server log. Maybe your OP is not setup correctly and never executed the way you wanted to.

    Make sure it is executed, first. You can print some log entries or even debug the server for this. Read our howto on this:
    viewtopic.php?f=5&t=423