public void OnClientConnectionRefused(NFNetEventParams eventParams) { if (mHandlerDelegation != null) { mHandlerDelegation(NFNetEventType.ConnectionRefused); } }
public void OnDataReceived(NFNetEventParams eventParams) { mPacket.Push(eventParams.packet.Sb, eventParams.packet.Sb.Size()); eventParams.packet.Sb.Clear(); OnDataReceived(); }
public void OnClientDisconnect(NFNetEventParams eventParams) { if (mHandlerDelegation != null) { mHandlerDelegation(NFNetEventType.Disconnected); } }
////////////////////////////////////////////////////////////////// /// public void OnClientConnect(NFNetEventParams eventParams) { Array.Clear(mPacket, 0, ConstDefine.MAX_PACKET_LEN); //NFLogModule.Instance.Log(NFLogModule.LOG_LEVEL.DEBUG, "Client connected"); mHandlerDelegation(NFNetEventType.Connected); }
////////////////////////////////////////////////////////////////// /// public void OnClientConnect(NFNetEventParams eventParams) { mPacket.Clear(); //NFLogModule.Instance.Log(NFLogModule.LOG_LEVEL.DEBUG, "Client connected"); if (mHandlerDelegation != null) { mHandlerDelegation(NFNetEventType.Connected); } }
public void OnDataReceived(NFNetEventParams eventParams) { byte[] bytes = eventParams.packet.bytes; int bytesCount = eventParams.packet.bytesCount; //NFLogModule.Instance.Log(NFLogModule.LOG_LEVEL.INFO, "ReciveDataSize:" + bytesCount); if (mnPacketSize + bytesCount < ConstDefine.MAX_PACKET_LEN) { Array.Copy(bytes, 0, mPacket, mnPacketSize, bytesCount); mnPacketSize += (UInt32)bytesCount; OnDataReceived(); } }
public void Execute() { while (mxEvents.Count > 0) { lock (mxEvents) { NFNetEventType eventType = mxEvents.Dequeue(); NFNetEventParams eventParams = new NFNetEventParams(); eventParams.eventType = eventType; eventParams.client = this; eventParams.socket = mxClient; if (eventType == NFNetEventType.Connected) { mxNetListener.OnClientConnect(eventParams); } else if (eventType == NFNetEventType.Disconnected) { mxNetListener.OnClientDisconnect(eventParams); mxReader.Close(); mxWriter.Close(); mxClient.Close(); } else if (eventType == NFNetEventType.DataReceived) { lock (mxPackets) { eventParams.packet = mxPackets.Dequeue(); mxNetListener.OnDataReceived(eventParams); } } else if (eventType == NFNetEventType.ConnectionRefused) { } } } }
public void OnClientConnectionRefused(NFNetEventParams eventParams) { //NFLogModule.Instance.Log(NFLogModule.LOG_LEVEL.DEBUG, "Client refused"); mHandlerDelegation(NFNetEventType.ConnectionRefused); }
public void OnClientDisconnect(NFNetEventParams eventParams) { //NFLogModule.Instance.Log(NFLogModule.LOG_LEVEL.DEBUG, "Client disconnected"); mHandlerDelegation(NFNetEventType.Disconnected); }