Check Opened Port
بررسی باز بودن پورت
Source
public static bool CheckOpenedPort(this int port)
{
IPGlobalProperties ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties();
IPEndPoint[] tcpConnInfoArray = ipGlobalProperties.GetActiveTcpListeners();
foreach (IPEndPoint endpoint in tcpConnInfoArray)
{
if (endpoint.Port == port)
{
return true;
}
}
return false;
}
Example
int portNumber = 507;
MessageBox.Show(portNumber.CheckOpenedPort().ToString());
Author: Mohammad Vafaei
Submitted on: 12 feb. 2018
Language: C#
Type: Extension Method Check Opened Port
Views: 3964