public static void SendData(byte[] packet, bool compress, bool encrypt, bool isPacketList) { if (tcpClient != null && tcpClient.Socket.Connected) { byte[] customHeader = new byte[GetCustomPacketHeaderSize()]; if (encrypt) { packet = packetModifiers.EncryptPacket(packet); customHeader[1] = 1; } if (packet.Length > 2000) { if (compress == false) { compress = true; } } if (compress) { packet = packetModifiers.CompressPacket(packet); customHeader[0] = 1; } if (isPacketList) { customHeader[2] = 1; } else { customHeader[2] = 0; } tcpClient.Send(packet, customHeader); } }
public void SendDataTo(byte[] data, TcpClient tcpClient) { tcpClient.Send(data); }