My S2S Peers never receive any OnOperation calls

Hi, I am trying to create a Photon Server Application from scratch, but I got stuck at S2S communication.
I am able to set up the connection, initialize encryption and event send operations using the peers (in both ways I always receive "OK" as send result), but OnOperationRequest is never called on the receiving peer. Even though in my log, I can find the exact piece of data, which is my operation request:

OperationData - PBase.OnReceive - ConnID=2, data=(47 bytes) F3-02-04-00-02-.....

What am I doing wrong?

Best Answer

  • Mort
    Mort
    Answer ✓
    Nevermind, found the problem. I was instanting a different class. I have no idea how LobbyMasterInPeer ended up in log though...

Answers

  • Hi, Mort.

    what version of sdk are you using?
    could you provide more logs?
    how do you create inbound server peer?

    best,
    ilya
  • I am using version 4.0.29.11263
    The is the log from master server (the first log entry is in the constructor of my InboundPeer)
    DEBUG MMORPG.WorldMaster.LobbyMasterInPeer - Connection from lobby received DEBUG Photon.SocketServer.PeerBase - OnInit - response sent to ConnId 0 with SendResult Ok DEBUG OperationData - OnInit - response sent to ConnID=0, send data=(3 bytes) F3-01-00 DEBUG Photon.SocketServer.PeerBase - Connection state changed from Initializing to Connected: peer=T:LobbyMasterInPeer,ConnId:0,ip:127.0.0.1:58131 DEBUG Photon.SocketServer.PeerBase - OnInit - response sent to ConnId 2 with SendResult Ok DEBUG OperationData - OnInit - response sent to ConnID=2, send data=(3 bytes) F3-01-00 DEBUG Photon.SocketServer.PeerBase - Connection state changed from Initializing to Connected: peer=T:GameMasterInPeer,ConnId:2,ip:127.0.0.1:52757 DEBUG OperationData - PBase.OnReceive - ConnID=2, data=(110 bytes) F3-06-00-00- ... DEBUG Photon.SocketServer.PeerBase - InitializeEncryption: conId=2, HashMode=SHA256, Paddin=PKCS7 DEBUG OperationData - SentOpResponse: Peer=T:GameMasterInPeer,ConnId:2,ip:127.0.0.1:52757, opCode=0, return=0, ChannelId=0, result=Ok, data=(110 bytes) F3-07-00-00-00- ... DEBUG OperationData - PBase.OnReceive - ConnID=2, data=(47 bytes) F3-02-04-00- ...

    And the "lobby" server:
    DEBUG Photon.SocketServer.PeerBase - Connection state changed from Disconnected to Connecting: peer=T:LobbyMasterOutPeer,ConnId:0,ip::0 DEBUG Photon.SocketServer.ServerToServer.OutboundS2SPeer - OnOutboundConncetionEstablished: remoteEndPoint=127.0.0.1:4057, localEndPoint=127.0.0.1:52757 INFO Photon.SocketServer.ApplicationBase - Application start: AppId=Lobby; AppPath=D:\dokumenty\develop\mmorpgPhoton\server\CustomMade\deploy\build, Type=MMORPG.Lobby.LobbyApplication DEBUG OperationData - PBase.OnReceive - ConnID=2, data=(3 bytes) F3-01-00 DEBUG Photon.SocketServer.PeerBase - Connection state changed from Connecting to Connected: peer=T:LobbyMasterOutPeer,ConnId:2,ip:127.0.0.1:4057 DEBUG MMORPG.Lobby.LobbyMasterOutPeer - Connection from lobby to master established DEBUG OperationData - PBase.OnReceive - ConnID=2, data=(110 bytes) F3-07-00-00-00-2A- ... DEBUG MMORPG.Lobby.LobbyMasterOutPeer - Encryption initialized DEBUG OperationData - SentOpRequest: ConnID=2, opCode=4, ChannelId=0 result=Ok, data=(47 bytes) F3-02-04-00-02- ...

    I create inboud peer in CreatePeer() method:
    protected override PeerBase CreatePeer( InitRequest initRequest ) { if(initRequest.LocalPort == 4056) { LobbyMasterInPeer peer = new LobbyMasterInPeer( initRequest, this ); lobbyServers.Add( peer ); return peer; } ...

    And the peer itself just inherits InboundS2SPeer, simply logging a message on every function call:
    public class LobbyMasterInPeer : InboundS2SPeer { private static readonly ILogger log = LogManager.GetCurrentClassLogger(); private WorldMasterApplication master; public LobbyMasterInPeer( InitRequest initRequest, WorldMasterApplication master ) : base( initRequest ) { this.master = master; log.DebugFormat( "Connection from lobby received" ); } protected override void OnDisconnect( DisconnectReason reasonCode, string reasonDetail ) { master.OnDisconnected( this ); log.Debug( "Lobby server disconnected from master" ); } protected override void OnOperationRequest( OperationRequest operationRequest, SendParameters sendParameters ) { log.Debug( "Incoming operation" ); } protected override void OnEvent( IEventData eventData, SendParameters sendParameters ) { log.Debug( "Incomming event" ); } protected override void OnOperationResponse( OperationResponse operationResponse, SendParameters sendParameters ) { log.Debug( "Incomming response" ); } }
  • I am using version 4.0.29.11263
    This is the log from master, from the moment that the "lobby" server connects:
    DEBUG MMORPG.WorldMaster.LobbyMasterInPeer - Connection from lobby received DEBUG Photon.SocketServer.PeerBase - OnInit - response sent to ConnId 0 with SendResult Ok DEBUG OperationData - OnInit - response sent to ConnID=0, send data=(3 bytes) F3-01-00 DEBUG Photon.SocketServer.PeerBase - Connection state changed from Initializing to Connected: peer=T:LobbyMasterInPeer,ConnId:0,ip:127.0.0.1:58131 DEBUG Photon.SocketServer.PeerBase - OnInit - response sent to ConnId 2 with SendResult Ok DEBUG OperationData - OnInit - response sent to ConnID=2, send data=(3 bytes) F3-01-00 DEBUG Photon.SocketServer.PeerBase - Connection state changed from Initializing to Connected: peer=T:GameMasterInPeer,ConnId:2,ip:127.0.0.1:52757 DEBUG OperationData - PBase.OnReceive - ConnID=2, data=(110 bytes) F3-06-00-00- ... DEBUG Photon.SocketServer.PeerBase - InitializeEncryption: conId=2, HashMode=SHA256, Paddin=PKCS7 DEBUG OperationData - SentOpResponse: Peer=T:GameMasterInPeer,ConnId:2,ip:127.0.0.1:52757, opCode=0, return=0, ChannelId=0, result=Ok, data=(110 bytes) F3-07-00-00-00- ... DEBUG OperationData - PBase.OnReceive - ConnID=2, data=(47 bytes) F3-02-04-00- ...
    And the log from client:
    DEBUG Photon.SocketServer.PeerBase - Connection state changed from Disconnected to Connecting: peer=T:LobbyMasterOutPeer,ConnId:0,ip::0 DEBUG Photon.SocketServer.ServerToServer.OutboundS2SPeer - OnOutboundConncetionEstablished: remoteEndPoint=127.0.0.1:4057, localEndPoint=127.0.0.1:52757 INFO Photon.SocketServer.ApplicationBase - Application start: AppId=Lobby; AppPath=D:\dokumenty\develop\mmorpgPhoton\server\CustomMade\deploy\build, Type=MMORPG.Lobby.LobbyApplication DEBUG OperationData - PBase.OnReceive - ConnID=2, data=(3 bytes) F3-01-00 DEBUG Photon.SocketServer.PeerBase - Connection state changed from Connecting to Connected: peer=T:LobbyMasterOutPeer,ConnId:2,ip:127.0.0.1:4057 DEBUG MMORPG.Lobby.LobbyMasterOutPeer - Connection from lobby to master established DEBUG OperationData - PBase.OnReceive - ConnID=2, data=(110 bytes) F3-07-00-00-00-2A- ... DEBUG MMORPG.Lobby.LobbyMasterOutPeer - Encryption initialized DEBUG OperationData - SentOpRequest: ConnID=2, opCode=4, ChannelId=0 result=Ok, data=(47 bytes) F3-02-04-00-02- ...

    Peer is created in CreatePeer() in my application:
    protected override PeerBase CreatePeer( InitRequest initRequest ) { if(initRequest.LocalPort == 4056) { LobbyMasterInPeer peer = new LobbyMasterInPeer( initRequest, this ); lobbyServers.Add( peer ); return peer; } ...
    And this is the code of the peer:
    public class LobbyMasterInPeer : InboundS2SPeer { private static readonly ILogger log = LogManager.GetCurrentClassLogger(); private WorldMasterApplication master; public LobbyMasterInPeer( InitRequest initRequest, WorldMasterApplication master ) : base( initRequest ) { this.master = master; log.DebugFormat( "Connection from lobby received" ); } protected override void OnDisconnect( DisconnectReason reasonCode, string reasonDetail ) { master.OnDisconnected( this ); log.Debug( "Lobby server disconnected from master" ); } protected override void OnOperationRequest( OperationRequest operationRequest, SendParameters sendParameters ) { log.Debug( "Incoming operation" ); } protected override void OnEvent( IEventData eventData, SendParameters sendParameters ) { log.Debug( "Incomming event" ); } protected override void OnOperationResponse( OperationResponse operationResponse, SendParameters sendParameters ) { log.Debug( "Incomming response" ); } }
  • Mort
    Mort
    Answer ✓
    Nevermind, found the problem. I was instanting a different class. I have no idea how LobbyMasterInPeer ended up in log though...
  • great you found it