[C#] C#判断远程计算机的指定端口是否打开 →→→→→进入此内容的聊天室

来自 , 2021-03-25, 写在 C#, 查看 119 次.
URL http://www.code666.cn/view/bb44c2e2
  1. using System.Net;
  2. if(!string.IsNullOrEmpty(txtPort.Text))
  3. {
  4.     IPAddress ip = IPAddress.Parse(txtIp.Text);
  5.     IPEndPoint point=new IPEndPoint(ip,int.Parse(txtPort.Text));
  6.     try
  7.     {
  8.         TcpClient tcp=new TcpClient();
  9.         tcp.Connect(point);
  10.         MessageBox.Show("端口打开");
  11.     }catch(Exception ex)
  12.     {
  13.         MessageBox.Show(ex.Message);
  14.     }
  15. }
  16. //csharp/6989

回复 "C#判断远程计算机的指定端口是否打开"

这儿你可以回复上面这条便签

captcha