private void SendHost()
        {
            byte          error;
            List <object> logicData = new List <object>();

            foreach (var command in OutgoingCommands)
            {
                logicData.Add(command.CommandId);
                logicData.AddRange(command.Data());
            }

            OutgoingCommands.Flush();

            if (logicData.Count == 0)
            {
                return;
            }

            int size;
            var buffer = UnnyNetPacker.PackObject(out size, logicData.ToArray());

            foreach (var connectionId in Connections)
            {
                NetworkTransport.Send(hostId, connectionId, realiableChannel, buffer, size, out error);
            }
        }
        private void DataEvent(int connectionId, int channelId, int dataSize, byte[] recBuffer)
        {
            // read data to commands
            var unpacked = UnnyNetPacker.UnpackObject(recBuffer, dataSize);

            for (int position = 0; position < unpacked.Length; position++)
            {
                var commandId = (byte)unpacked[position];

                var cmd = Container.ResolveId <ICommand>(commandId);
                cmd.Read(unpacked, ref position);
                cmd.Connection = connectionId;
                IncomingCommands.Enqueue(cmd);
            }
        }