예제 #1
0
        public void Send(NetworkOutgoingMessage message, Action callback)
        {
            if (listener.IsAvailable(identifier))
            {
                DataBlock    block  = new NetworkOutgoingBlock(memory.Data, offset, message.Length);
                SocketBuffer buffer = new SocketBuffer(memory.Data, offset, message.Length);

                message.ToBytes(block);
                encryptor?.Encrypt(memory.Data, offset, message.Length);

                offset += message.Length;
                parts.Add(offset);

                socket.Send(buffer, OnSent(callback));
            }
        }
예제 #2
0
 public void ToBytes(DataBlock block)
 {
     inner.ToBytes(block);
     key.Encrypt(block);
 }