コード例 #1
0
        /// <summary>
        /// <para>This inializes the internal data structures of a NetworkConnection object, including channel buffers.</para>
        /// </summary>
        /// <param name="hostTopology">The topology to be used.</param>
        /// <param name="networkAddress">The host or IP connected to.</param>
        /// <param name="networkHostId">The transport hostId for the connection.</param>
        /// <param name="networkConnectionId">The transport connectionId for the connection.</param>
        public virtual void Initialize(string networkAddress, int networkHostId, int networkConnectionId, HostTopology hostTopology)
        {
            this.m_Writer     = new NetworkWriter();
            this.address      = networkAddress;
            this.hostId       = networkHostId;
            this.connectionId = networkConnectionId;
            int channelCount = hostTopology.DefaultConfig.ChannelCount;
            int packetSize   = hostTopology.DefaultConfig.PacketSize;

            if ((hostTopology.DefaultConfig.UsePlatformSpecificProtocols && (Application.platform != RuntimePlatform.PS4)) && (Application.platform != RuntimePlatform.PSP2))
            {
                throw new ArgumentOutOfRangeException("Platform specific protocols are not supported on this platform");
            }
            this.m_Channels = new ChannelBuffer[channelCount];
            for (int i = 0; i < channelCount; i++)
            {
                ChannelQOS lqos       = hostTopology.DefaultConfig.Channels[i];
                int        bufferSize = packetSize;
                if ((lqos.QOS == QosType.ReliableFragmented) || (lqos.QOS == QosType.UnreliableFragmented))
                {
                    bufferSize = hostTopology.DefaultConfig.FragmentSize * 0x80;
                }
                this.m_Channels[i] = new ChannelBuffer(this, bufferSize, (byte)i, IsReliableQoS(lqos.QOS), IsSequencedQoS(lqos.QOS));
            }
        }
コード例 #2
0
        /// <summary>
        ///   <para>This inializes the internal data structures of a NetworkConnection object, including channel buffers.</para>
        /// </summary>
        /// <param name="address">The host or IP connected to.</param>
        /// <param name="hostId">The transport hostId for the connection.</param>
        /// <param name="connectionId">The transport connectionId for the connection.</param>
        /// <param name="hostTopology">The topology to be used.</param>
        /// <param name="networkAddress"></param>
        /// <param name="networkHostId"></param>
        /// <param name="networkConnectionId"></param>
        public virtual void Initialize(string networkAddress, int networkHostId, int networkConnectionId, HostTopology hostTopology)
        {
            this.m_Writer     = new NetworkWriter();
            this.address      = networkAddress;
            this.hostId       = networkHostId;
            this.connectionId = networkConnectionId;
            int channelCount = hostTopology.DefaultConfig.ChannelCount;
            int packetSize   = (int)hostTopology.DefaultConfig.PacketSize;

            if (hostTopology.DefaultConfig.UsePlatformSpecificProtocols && Application.platform != RuntimePlatform.PS4)
            {
                throw new ArgumentOutOfRangeException("Platform specific protocols are not supported on this platform");
            }
            this.m_Channels = new ChannelBuffer[channelCount];
            for (int index = 0; index < channelCount; ++index)
            {
                ChannelQOS channel    = hostTopology.DefaultConfig.Channels[index];
                int        bufferSize = packetSize;
                if (channel.QOS == QosType.ReliableFragmented || channel.QOS == QosType.UnreliableFragmented)
                {
                    bufferSize = (int)hostTopology.DefaultConfig.FragmentSize * 128;
                }
                this.m_Channels[index] = new ChannelBuffer(this, bufferSize, (byte)index, NetworkConnection.IsReliableQoS(channel.QOS));
            }
        }
コード例 #3
0
 public ChannelQOS(ChannelQOS channel)
 {
     if (channel == null)
     {
         throw new NullReferenceException("channel is not defined");
     }
     this.m_Type = channel.m_Type;
 }
コード例 #4
0
ファイル: ChannelQOS.cs プロジェクト: randomize/VimConfig
 public ChannelQOS(ChannelQOS channel)
 {
     if (channel == null)
     {
         throw new NullReferenceException("channel is not defined");
     }
     this.m_Type = channel.m_Type;
 }
コード例 #5
0
 public ChannelQOS(ChannelQOS channel)
 {
     if (channel == null)
     {
         throw new NullReferenceException("channel is not defined");
     }
     m_Type = channel.m_Type;
     m_BelongsSharedOrderChannel = channel.m_BelongsSharedOrderChannel;
 }
コード例 #6
0
        public ChannelQOS(ChannelQOS channel)
        {
            bool flag = channel == null;

            if (flag)
            {
                throw new NullReferenceException("channel is not defined");
            }
            this.m_Type = channel.m_Type;
            this.m_BelongsSharedOrderChannel = channel.m_BelongsSharedOrderChannel;
        }
コード例 #7
0
        public void MakeChannelsSharedOrder(List <byte> channelIndices)
        {
            bool flag = channelIndices == null;

            if (flag)
            {
                throw new NullReferenceException("channelIndices must not be null");
            }
            bool flag2 = channelIndices.Count == 0;

            if (flag2)
            {
                throw new ArgumentOutOfRangeException("Received empty list of shared order channel indexes");
            }
            byte b = 0;

            while ((int)b < channelIndices.Count)
            {
                byte b2    = channelIndices[(int)b];
                bool flag3 = (int)b2 >= this.m_Channels.Count;
                if (flag3)
                {
                    throw new ArgumentOutOfRangeException("Shared order channel list contains wrong channel index " + b2.ToString());
                }
                ChannelQOS channelQOS = this.m_Channels[(int)b2];
                bool       belongsToSharedOrderChannel = channelQOS.BelongsToSharedOrderChannel;
                if (belongsToSharedOrderChannel)
                {
                    throw new ArgumentException("Channel with index " + b2.ToString() + " has been already included to other shared order channel");
                }
                bool flag4 = channelQOS.QOS != QosType.Reliable && channelQOS.QOS > QosType.Unreliable;
                if (flag4)
                {
                    throw new ArgumentException("Only Reliable and Unreliable QoS are allowed for shared order channel, wrong channel is with index " + b2.ToString());
                }
                b += 1;
            }
            byte b3 = 0;

            while ((int)b3 < channelIndices.Count)
            {
                byte index = channelIndices[(int)b3];
                this.m_Channels[(int)index].m_BelongsSharedOrderChannel = true;
                b3 += 1;
            }
            List <byte> item = new List <byte>(channelIndices);

            this.m_SharedOrderChannels.Add(item);
        }
コード例 #8
0
        public byte AddChannel(QosType value)
        {
            if (m_Channels.Count > 255)
            {
                throw new ArgumentOutOfRangeException("Channels Count should be less than 256");
            }
            if (!Enum.IsDefined(typeof(QosType), value))
            {
                throw new ArgumentOutOfRangeException("requested qos type doesn't exist: " + (int)value);
            }
            ChannelQOS item = new ChannelQOS(value);

            m_Channels.Add(item);
            return((byte)(m_Channels.Count - 1));
        }
コード例 #9
0
        public virtual void Initialize(string networkAddress, int networkHostId, int networkConnectionId, HostTopology hostTopology)
        {
            this.m_Writer     = new NetworkWriter();
            this.address      = networkAddress;
            this.hostId       = networkHostId;
            this.connectionId = networkConnectionId;
            int channelCount = hostTopology.DefaultConfig.ChannelCount;
            int packetSize   = hostTopology.DefaultConfig.PacketSize;

            this.m_Channels = new ChannelBuffer[channelCount];
            for (int i = 0; i < channelCount; i++)
            {
                ChannelQOS lqos = hostTopology.DefaultConfig.Channels[i];
                this.m_Channels[i] = new ChannelBuffer(this, packetSize, (byte)i, IsReliableQoS(lqos.QOS));
            }
        }
コード例 #10
0
        public byte AddChannel(QosType value)
        {
            bool flag = this.m_Channels.Count > 255;

            if (flag)
            {
                throw new ArgumentOutOfRangeException("Channels Count should be less than 256");
            }
            bool flag2 = !Enum.IsDefined(typeof(QosType), value);

            if (flag2)
            {
                string arg_4D_0 = "requested qos type doesn't exist: ";
                int    num      = (int)value;
                throw new ArgumentOutOfRangeException(arg_4D_0 + num.ToString());
            }
            ChannelQOS item = new ChannelQOS(value);

            this.m_Channels.Add(item);
            return((byte)(this.m_Channels.Count - 1));
        }
コード例 #11
0
        public virtual void Initialize(string networkAddress, int networkHostId, int networkConnectionId, HostTopology hostTopology)
        {
            this.m_Writer     = new NetworkWriter();
            this.address      = networkAddress;
            this.hostId       = networkHostId;
            this.connectionId = networkConnectionId;
            int channelCount = hostTopology.DefaultConfig.ChannelCount;
            int packetSize   = (int)hostTopology.DefaultConfig.PacketSize;

            this.m_Channels = new ChannelBuffer[channelCount];
            for (int i = 0; i < channelCount; i++)
            {
                ChannelQOS channelQOS = hostTopology.DefaultConfig.Channels[i];
                int        bufferSize = packetSize;
                if (channelQOS.QOS == QosType.ReliableFragmented || channelQOS.QOS == QosType.UnreliableFragmented)
                {
                    bufferSize = (int)(hostTopology.DefaultConfig.FragmentSize * 128);
                }
                this.m_Channels[i] = new ChannelBuffer(this, bufferSize, (byte)i, NetworkConnection.IsReliableQoS(channelQOS.QOS));
            }
        }
コード例 #12
0
        public void MakeChannelsSharedOrder(List <byte> channelIndices)
        {
            if (channelIndices == null)
            {
                throw new NullReferenceException("channelIndices must not be null");
            }
            if (channelIndices.Count == 0)
            {
                throw new ArgumentOutOfRangeException("Received empty list of shared order channel indexes");
            }
            for (byte i = 0; i < channelIndices.Count; i++)
            {
                byte channelId = channelIndices[i];
                if (channelId >= m_Channels.Count)
                {
                    throw new ArgumentOutOfRangeException("Shared order channel list contains wrong channel index " + channelId);
                }
                ChannelQOS channel = m_Channels[channelId];
                if (channel.BelongsToSharedOrderChannel)
                {
                    throw new ArgumentException("Channel with index " + channelId + " has been already included to other shared order channel");
                }
                if (!(channel.QOS == QosType.Reliable || channel.QOS == QosType.Unreliable))
                {
                    throw new ArgumentException("Only Reliable and Unreliable QoS are allowed for shared order channel, wrong channel is with index " + channelId);
                }
            }
            for (byte i = 0; i < channelIndices.Count; i++)
            {
                byte channelId = channelIndices[i];
                m_Channels[channelId].m_BelongsSharedOrderChannel = true;
            }
            List <byte> newChannelIndices = new List <byte>(channelIndices);

            m_SharedOrderChannels.Add(newChannelIndices);
        }
コード例 #13
0
 public byte AddChannel(QosType value)
 {
     if (this.m_Channels.Count > 0xff)
     {
         throw new ArgumentOutOfRangeException("Channels Count should be less than 256");
     }
     if (!Enum.IsDefined(typeof(QosType), value))
     {
         throw new ArgumentOutOfRangeException("requested qos type doesn't exist: " + ((int) value));
     }
     ChannelQOS item = new ChannelQOS(value);
     this.m_Channels.Add(item);
     return (byte) (this.m_Channels.Count - 1);
 }