UnityEngine.Networking.ConnectionConfig.Validate C# (CSharp) Method

Validate() public static method

Validate parameters of connection config. Will throw exceptions if parameters are incorrect.

public static Validate ( ConnectionConfig config ) : void
config ConnectionConfig
return void
        public static void Validate(ConnectionConfig config)
        {
            if (config.m_PacketSize < 0x80)
            {
                int num = 0x80;
                throw new ArgumentOutOfRangeException("PacketSize should be > " + num.ToString());
            }
            if (config.m_FragmentSize >= (config.m_PacketSize - 0x80))
            {
                int num2 = 0x80;
                throw new ArgumentOutOfRangeException("FragmentSize should be < PacketSize - " + num2.ToString());
            }
            if (config.m_Channels.Count > 0xff)
            {
                throw new ArgumentOutOfRangeException("Channels number should be less than 256");
            }
        }

Usage Example

コード例 #1
0
 /// <summary>
 ///   <para>Create topology.</para>
 /// </summary>
 /// <param name="defaultConfig">Default config.</param>
 /// <param name="maxDefaultConnections">Maximum default connections.</param>
 public HostTopology(ConnectionConfig defaultConfig, int maxDefaultConnections)
 {
     if (defaultConfig == null)
     {
         throw new NullReferenceException("config is not defined");
     }
     if (maxDefaultConnections <= 0)
     {
         throw new ArgumentOutOfRangeException("maxDefaultConnections", "count connection should be > 0");
     }
     if (maxDefaultConnections > 65535)
     {
         throw new ArgumentOutOfRangeException("maxDefaultConnections", "count connection should be < 65535");
     }
     ConnectionConfig.Validate(defaultConfig);
     this.m_DefConfig         = new ConnectionConfig(defaultConfig);
     this.m_MaxDefConnections = maxDefaultConnections;
 }
All Usage Examples Of UnityEngine.Networking.ConnectionConfig::Validate