AddHostWrapper() private method

private AddHostWrapper ( HostTopologyInternal topologyInt, string ip, int port, int minTimeout, int maxTimeout ) : int
topologyInt HostTopologyInternal
ip string
port int
minTimeout int
maxTimeout int
return int
 /// <summary>
 ///   <para>Create a host (open socket) and configure them to simulate internet latency (works on editor and development build only).</para>
 /// </summary>
 /// <param name="topology">The host topology for this host.</param>
 /// <param name="minTimeout">Minimum simulated delay.</param>
 /// <param name="maxTimeout">Maximum simulated delay.</param>
 /// <param name="port">Bind to specific port, if 0 is selected the port will chosen by OS.</param>
 /// <param name="ip">Bind to specific IP address.</param>
 /// <returns>
 ///   <para>Returns host ID just created.</para>
 /// </returns>
 public static int AddHostWithSimulator(HostTopology topology, int minTimeout, int maxTimeout, [DefaultValue("0")] int port, [DefaultValue("null")] string ip)
 {
     if (topology == null)
     {
         throw new NullReferenceException("topology is not defined");
     }
     if (ip == null)
     {
         return(NetworkTransport.AddHostWrapperWithoutIp(new HostTopologyInternal(topology), port, minTimeout, maxTimeout));
     }
     return(NetworkTransport.AddHostWrapper(new HostTopologyInternal(topology), ip, port, minTimeout, maxTimeout));
 }
Esempio n. 2
0
        public static int AddHost(HostTopology topology, [DefaultValue("0")] int port, [DefaultValue("null")] string ip)
        {
            if (topology == null)
            {
                throw new NullReferenceException("topology is not defined");
            }
            int result;

            if (ip == null)
            {
                result = NetworkTransport.AddHostWrapperWithoutIp(new HostTopologyInternal(topology), port, 0, 0);
            }
            else
            {
                result = NetworkTransport.AddHostWrapper(new HostTopologyInternal(topology), ip, port, 0, 0);
            }
            return(result);
        }