I connect the server success, but when I send message, it return a OperationCode"Unknown operation "

Options
I use client by unity connect the server success, but when I send message, it returns message's OperationCode is "Unknown operation code", and I cannot get data from server
How can I solve this

Answers

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @ZunQing,

    Thank you for choosing Photon!

    What Unity SDK do you use? PUN or Photon Realtime?
    What operation are you calling and from which server (Master or Game)?
  • ZunQing
    Options
    Thanks for your help~

    I use the Photon3Unity3D.dll from PhotonServer
    And I create my server project named "HookFatWar", and edit the config file PhotonServer.config
    add this


    in LoadBalancing's application

    In unity, I use this to connect server (It can connect success)
    m_peer = new PhotonPeer(this, ConnectionProtocol.Udp);
    m_peer.Connect("172.16.102.10:5055", "HookFatWar");

    But when I try to send message:
    Dictionary para = new Dictionary();
    para[0] = 10;
    m_peer.OpCustom((byte)10, para, true);

    I cannot get data from server, it seems like not run my server code in project HookFatWar
    switch (operationRequest.OperationCode)
    {
    case (byte)10:
    {
    OperationResponse res = new OperationResponse();
    res.ReturnCode = (short)10;
    res.DebugMessage = "success";
    res.OperationCode = (byte)10;

    Dictionary para = new Dictionary();
    para[(byte)0] = m_curScore;
    para[(byte)1] = m_curScore;
    res.Parameters = para;

    SendOperationResponse(res, new SendParameters());
    }
    break;

    Thank you again :)