Esempio n. 1
0
        public bool Send(object[] data)
        {
            if (ClientSocket.Connected)
            {
                if (UseEncryption)
                {
                    byte[] dataPacket = EncryptionSettings.Encrypt(Compress(DataFormatter.ConvertToByte(data)), EncryptionKey);
                    ClientSocket.BeginSend(dataPacket, 0, dataPacket.Length, SocketFlags.None, new AsyncCallback(OnSend), ClientSocket);
                }
                else
                {
                    byte[] dataPacket = Compress(DataFormatter.ConvertToByte(data));
                    ClientSocket.BeginSend(dataPacket, 0, dataPacket.Length, SocketFlags.None, new AsyncCallback(OnSend), ClientSocket);
                }

                return(true);
            }

            return(false);
        }