Process p = new Process();
            p.StartInfo = new ProcessStartInfo("netstat", "-a");
            p.StartInfo.CreateNoWindow = true;
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            p.StartInfo.RedirectStandardOutput = true;
            p.Start();
            string result = p.StandardOutput.ReadToEnd();
            if (result.IndexOf(Environment.MachineName.ToLower() + ":4000") >= 0)
                MessageBox.Show("4000端口被占用");
            else
            {
                MessageBox.Show("ok");
            }       

相关文章:

  • 2022-12-23
  • 2021-12-21
  • 2021-08-28
  • 2021-12-06
  • 2022-01-20
  • 2021-10-16
猜你喜欢
  • 2022-12-23
  • 2021-11-09
  • 2022-12-23
  • 2021-09-04
  • 2022-01-19
  • 2022-01-31
  • 2021-12-06
相关资源
相似解决方案