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)); }
/// <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); } }
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)); } } }