Exemplo n.º 1
0
        /// 处理游戏服务器命令(返回二进制格式)
        private static bool ProcessGameStreamCmd(TCPClient client, int nID, byte[] data, int count)
        {
            byte[] bytesData = new byte[count];
            DataHelper.CopyBytes(bytesData, 0, data, 0, count);

            //通知外部
            client.NotifyRecvData(new SocketConnectEventArgs()
            {
                Error         = "Success",
                NetSocketType = (int)NetSocketTypes.SOCKT_CMD,
                CmdID         = (int)nID,
                fields        = null,
                bytesData     = bytesData,
            });
            return(true);
        }
Exemplo n.º 2
0
        /// 处理游戏服务器命令
        private static bool ProcessGameCmd(TCPClient client, int nID, byte[] data, int count)
        {
            string strData = new UTF8Encoding().GetString(data, 0, count);

            //解析客户端的指令
            string[] fields = strData.Split(':');

            //通知外部
            client.NotifyRecvData(new SocketConnectEventArgs()
            {
                Error         = "Success",
                NetSocketType = (int)NetSocketTypes.SOCKT_CMD,
                CmdID         = (int)nID,
                fields        = fields
            });
            return(true);
        }