示例#1
0
        public void SendDataToServer(byte[] data)
        {
            ProxyData tmp = new ProxyData();

            tmp.Source = this.Id;
            tmp.Data   = data;
            tmp.Ids    = new List <long>();
            tmp.Ids.Add(0);
            MainClient.BeginSendData(BufferFormat.FormatFCA(tmp));
        }
示例#2
0
        /// <summary>
        /// 发送数据包给所有人,不包括服务器
        /// </summary>
        /// <param name="data"></param>
        public void SendDataToALLClient(byte[] data)
        {
            var list = GetNotConnectSession();

            if (list.Count > 0)
            {
                ProxyData tmp = new ProxyData();
                tmp.Source = this.Id;
                tmp.Data   = data;
                tmp.Ids    = list;
                MainClient.BeginSendData(BufferFormat.FormatFCA(tmp));
            }

            foreach (var item in GetConnectSession())
            {
                item.Client.SendData(data);
            }
        }
示例#3
0
        public void SendData(long Id, byte[] data)
        {
            if (ConnUserList.ContainsKey(Id))
            {
                var session = ConnUserList[Id];

                if (session.IsConnect && session.Client != null)
                {
                    session.Client.SendData(data);
                }
                else
                {
                    ProxyData tmp = new ProxyData();
                    tmp.Source = this.Id;
                    tmp.Data   = data;
                    tmp.Ids    = new List <long>();
                    tmp.Ids.Add(Id);
                    MainClient.BeginSendData(BufferFormat.FormatFCA(tmp));
                }
            }
        }