Hello, I'm a newbie about Photon Server. I follow some tutorial to setup the LiteApplication and LitePeer step by step, however when I send the message with OpRaiseEvent(), there are noting happen... Image may be NSFW.
Clik here to view.
. I try to check the log and find the log stop at Executing operation RaiseEvent. What's wrong with my code .... Image may be NSFW.
Clik here to view.
. I can't find simaler question with google, really need help..
following is some detail:
Win7 x64 ,Photon Server : bin_Win64, Client: Unity3D 5.2
Log
2015-12-25 23:54:42,415 [12] DEBUG Photon.SocketServer.ApplicationBase [(null)] - OnInit - response sent to ConnId 1 with SendResult Ok
2015-12-25 23:54:44,926 [11] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - OnOperationRequest 取得資料 Key:值
2015-12-25 23:54:44,927 [11] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - OPCode:255
2015-12-25 23:54:44,927 [11] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - 4
2015-12-25 23:54:44,928 [11] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - 255:TestRoom
2015-12-25 23:54:44,928 [11] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - 249:System.Collections.Hashtable
2015-12-25 23:54:44,929 [11] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - 248:System.Collections.Hashtable
2015-12-25 23:54:44,929 [11] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - 250:True
2015-12-25 23:54:44,930 [11] DEBUG Lite.LitePeer [(null)] - OnOperationRequest. Code=255
2015-12-25 23:54:44,945 [11] DEBUG Lite.Caching.RoomCacheBase [(null)] - Creating room instance: roomName=TestRoom
2015-12-25 23:54:44,950 [11] DEBUG Lite.Caching.RoomCacheBase [(null)] - Created room instance reference: roomName=TestRoom, referenceCount=1
2015-12-25 23:54:44,953 [13] DEBUG Lite.Room [(null)] - Executing operation Join
2015-12-25 23:54:44,956 [13] DEBUG Lite.Room [(null)] - Join operation from IP: 127.0.0.1 to port: 5055
2015-12-25 23:54:44,957 [13] DEBUG Lite.Room [(null)] - Actor added: 1 to game: TestRoom
2015-12-25 23:54:44,968 [13] DEBUG Photon.SocketServer.PeerBase [(null)] - SentOpResponse: ConnID=1, opCode=255, return=0, ChannelId=0 result=Ok size=14 bytes
2015-12-25 23:54:49,878 [14] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - OnOperationRequest 取得資料 Key:值
2015-12-25 23:54:49,879 [14] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - OPCode:253
2015-12-25 23:54:49,879 [14] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - 2
2015-12-25 23:54:49,880 [14] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - 245:System.Collections.Hashtable
2015-12-25 23:54:49,880 [14] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - 244:20
2015-12-25 23:54:49,880 [14] DEBUG Lite.LitePeer [(null)] - OnOperationRequest. Code=253
2015-12-25 23:54:49,881 [13] DEBUG Lite.Room [(null)] - Executing operation RaiseEvent <--stop here and nothing happen
2015-12-25 23:55:52,407 [15] DEBUG Photon.SocketServer.ApplicationBase [(null)] - OnDisconnect - ConnID=1
LiteApplication detail:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Photon.SocketServer;
using ExitGames.Logging;
using ExitGames.Logging.Log4Net;
using log4net;
using log4net.Config;
using LogManager = ExitGames.Logging.LogManager;
using System.IO;
using Lite;
using System.Threading;
namespace ZuGonLiteServer{
public class ZuGonLiteApplication : LiteApplication
{
static Dictionary<int, ZuGonLitePeer> clientsPeers = new Dictionary();
Timer serverTimer = new Timer(BroadCastServerTime,null,10000,10000);
public enum ClientEventTimeCode { FreshTime=3}
public enum ClientEventTimeKey { Time=3}
protected static readonly ILogger Log = LogManager.GetCurrentClassLogger();
protected override PeerBase CreatePeer(InitRequest initRequest)
{
ZuGonLitePeer myPeer= new ZuGonLitePeer(initRequest.Protocol,initRequest.PhotonPeer);
clientsPeers.Add(myPeer.ConnectionId,myPeer);
return myPeer;
}
protected override void Setup()
{
LogManager.SetLoggerFactory(Log4NetLoggerFactory.Instance);
GlobalContext.Properties["LogFileName"] = ApplicationName + System.DateTime.Now.ToString("yy-MM-dd");
XmlConfigurator.ConfigureAndWatch(new FileInfo(Path.Combine(BinaryPath, "log4net.config")));
}
protected override void TearDown() { }
}
}
LitePeer detail:
using System;
using System.Collections;
using System.Collections.Generic;
using ClientReqHandler;
using ExitGames.Concurrency.Fibers;
using ExitGames.Logging;
using Lite;
using Photon.SocketServer;
using PhotonHostRuntimeInterfaces;
namespace ZuGonLiteServer
{
public class ZuGonLitePeer : LitePeer
{
private readonly IFiber fiber;
protected static readonly ILogger Log = LogManager.GetCurrentClassLogger();
public ZuGonLitePeer(IRpcProtocol protocol, IPhotonPeer unmanagedPeer) : base(protocol, unmanagedPeer)
{
this.fiber = new PoolFiber();
this.fiber.Start();
}
protected override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters)
{
if (Log.IsDebugEnabled)
{
Log.Debug("OnOperationRequest get Key:Value");
Log.DebugFormat(string.Format("OPCode:{0}", operationRequest.OperationCode));
Log.DebugFormat(String.Format("{0}", operationRequest.Parameters.Count));
foreach (var item in operationRequest.Parameters)
{
Log.DebugFormat(string.Format("{0}:{1}", item.Key, item.Value));
}
}
if (operationRequest.OperationCode <= 255 && operationRequest.OperationCode > 247)
{
base.OnOperationRequest(operationRequest, sendParameters);
}
else{ }
}
protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail) { }
}
}
Client detail:
public void SendChatMsg()
{
Hashtable msg = new Hashtable();
msg.Add(0,"test");
litePeer.OpRaiseEvent((byte)GameOpCode.Chat, msg,true);
}
public void OnEvent(EventData eventData)
{
Debug.Log(eventData.ToStringFull());
switch (eventData.Code)
{
case (byte)GameOpCode.Chat:
Debug.Log("get the msg");
break;
}
}
Clik here to view.

Clik here to view.

following is some detail:
Win7 x64 ,Photon Server : bin_Win64, Client: Unity3D 5.2
Log
2015-12-25 23:54:42,415 [12] DEBUG Photon.SocketServer.ApplicationBase [(null)] - OnInit - response sent to ConnId 1 with SendResult Ok
2015-12-25 23:54:44,926 [11] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - OnOperationRequest 取得資料 Key:值
2015-12-25 23:54:44,927 [11] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - OPCode:255
2015-12-25 23:54:44,927 [11] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - 4
2015-12-25 23:54:44,928 [11] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - 255:TestRoom
2015-12-25 23:54:44,928 [11] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - 249:System.Collections.Hashtable
2015-12-25 23:54:44,929 [11] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - 248:System.Collections.Hashtable
2015-12-25 23:54:44,929 [11] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - 250:True
2015-12-25 23:54:44,930 [11] DEBUG Lite.LitePeer [(null)] - OnOperationRequest. Code=255
2015-12-25 23:54:44,945 [11] DEBUG Lite.Caching.RoomCacheBase [(null)] - Creating room instance: roomName=TestRoom
2015-12-25 23:54:44,950 [11] DEBUG Lite.Caching.RoomCacheBase [(null)] - Created room instance reference: roomName=TestRoom, referenceCount=1
2015-12-25 23:54:44,953 [13] DEBUG Lite.Room [(null)] - Executing operation Join
2015-12-25 23:54:44,956 [13] DEBUG Lite.Room [(null)] - Join operation from IP: 127.0.0.1 to port: 5055
2015-12-25 23:54:44,957 [13] DEBUG Lite.Room [(null)] - Actor added: 1 to game: TestRoom
2015-12-25 23:54:44,968 [13] DEBUG Photon.SocketServer.PeerBase [(null)] - SentOpResponse: ConnID=1, opCode=255, return=0, ChannelId=0 result=Ok size=14 bytes
2015-12-25 23:54:49,878 [14] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - OnOperationRequest 取得資料 Key:值
2015-12-25 23:54:49,879 [14] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - OPCode:253
2015-12-25 23:54:49,879 [14] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - 2
2015-12-25 23:54:49,880 [14] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - 245:System.Collections.Hashtable
2015-12-25 23:54:49,880 [14] DEBUG ZuGonLiteServer.ZuGonLitePeer [(null)] - 244:20
2015-12-25 23:54:49,880 [14] DEBUG Lite.LitePeer [(null)] - OnOperationRequest. Code=253
2015-12-25 23:54:49,881 [13] DEBUG Lite.Room [(null)] - Executing operation RaiseEvent <--stop here and nothing happen
2015-12-25 23:55:52,407 [15] DEBUG Photon.SocketServer.ApplicationBase [(null)] - OnDisconnect - ConnID=1
LiteApplication detail:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Photon.SocketServer;
using ExitGames.Logging;
using ExitGames.Logging.Log4Net;
using log4net;
using log4net.Config;
using LogManager = ExitGames.Logging.LogManager;
using System.IO;
using Lite;
using System.Threading;
namespace ZuGonLiteServer{
public class ZuGonLiteApplication : LiteApplication
{
static Dictionary<int, ZuGonLitePeer> clientsPeers = new Dictionary();
Timer serverTimer = new Timer(BroadCastServerTime,null,10000,10000);
public enum ClientEventTimeCode { FreshTime=3}
public enum ClientEventTimeKey { Time=3}
protected static readonly ILogger Log = LogManager.GetCurrentClassLogger();
protected override PeerBase CreatePeer(InitRequest initRequest)
{
ZuGonLitePeer myPeer= new ZuGonLitePeer(initRequest.Protocol,initRequest.PhotonPeer);
clientsPeers.Add(myPeer.ConnectionId,myPeer);
return myPeer;
}
protected override void Setup()
{
LogManager.SetLoggerFactory(Log4NetLoggerFactory.Instance);
GlobalContext.Properties["LogFileName"] = ApplicationName + System.DateTime.Now.ToString("yy-MM-dd");
XmlConfigurator.ConfigureAndWatch(new FileInfo(Path.Combine(BinaryPath, "log4net.config")));
}
protected override void TearDown() { }
}
}
LitePeer detail:
using System;
using System.Collections;
using System.Collections.Generic;
using ClientReqHandler;
using ExitGames.Concurrency.Fibers;
using ExitGames.Logging;
using Lite;
using Photon.SocketServer;
using PhotonHostRuntimeInterfaces;
namespace ZuGonLiteServer
{
public class ZuGonLitePeer : LitePeer
{
private readonly IFiber fiber;
protected static readonly ILogger Log = LogManager.GetCurrentClassLogger();
public ZuGonLitePeer(IRpcProtocol protocol, IPhotonPeer unmanagedPeer) : base(protocol, unmanagedPeer)
{
this.fiber = new PoolFiber();
this.fiber.Start();
}
protected override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters)
{
if (Log.IsDebugEnabled)
{
Log.Debug("OnOperationRequest get Key:Value");
Log.DebugFormat(string.Format("OPCode:{0}", operationRequest.OperationCode));
Log.DebugFormat(String.Format("{0}", operationRequest.Parameters.Count));
foreach (var item in operationRequest.Parameters)
{
Log.DebugFormat(string.Format("{0}:{1}", item.Key, item.Value));
}
}
if (operationRequest.OperationCode <= 255 && operationRequest.OperationCode > 247)
{
base.OnOperationRequest(operationRequest, sendParameters);
}
else{ }
}
protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail) { }
}
}
Client detail:
public void SendChatMsg()
{
Hashtable msg = new Hashtable();
msg.Add(0,"test");
litePeer.OpRaiseEvent((byte)GameOpCode.Chat, msg,true);
}
public void OnEvent(EventData eventData)
{
Debug.Log(eventData.ToStringFull());
switch (eventData.Code)
{
case (byte)GameOpCode.Chat:
Debug.Log("get the msg");
break;
}
}