public void BroadCast(SendBasePacket packet) { for (int i = 0; i < _clientList.Count; i++) { try { _clientList[i].SendPacket(packet); settings.SendedPackets++; } catch { } } }
public void SendPacket(SendBasePacket packet) { lock(this) { packet.Write(); byte[] pck = packet.ToByteArray(); byte PacketId = pck[0]; pck = CryptEngine.Crypt(pck, NetworkKey); List<Byte> FullPacket = new List<Byte>(); FullPacket.AddRange(BitConverter.GetBytes((short)(pck.Length + 2))); //+2 Packet Length FullPacket.AddRange(pck); try { _socket.Send(FullPacket.ToArray()); } catch { } settings.SendedPackets++; } }