TryNextPort() публичный Метод

public TryNextPort ( ) : Settings
Результат Settings
Пример #1
0
        static Tuple<Process, int> StartOnFirstFreePort(Settings settings)
        {
            do
              {
            try
            {
              Console.WriteLine("Trying to start {0} {1} on port {2}",
                            settings.Executable,
                            settings.Arguments(settings),
                            settings.Port);

              var process = StartProcess(settings);

              Console.WriteLine("Started [{0}] {1} on port {2}", process.Id, settings.Executable, settings.Port);
              settings.Started(process, settings);

              return new Tuple<Process, int>(process, settings.Port);
            }
            catch (Exception ex)
            {
              Console.WriteLine(ex.Message);
            }

            settings = settings.TryNextPort();
              }
              while (true);
        }
Пример #2
0
        static Tuple <Process, int> StartOnFirstFreePort(Settings settings)
        {
            do
            {
                try
                {
                    Console.WriteLine("Trying to start {0} {1} on port {2}",
                                      settings.Executable,
                                      settings.Arguments(settings),
                                      settings.Port);

                    var process = StartProcess(settings);

                    Console.WriteLine("Started [{0}] {1} on port {2}", process.Id, settings.Executable, settings.Port);
                    settings.Started(process, settings);

                    return(new Tuple <Process, int>(process, settings.Port));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                settings = settings.TryNextPort();
            }while (true);
        }