-
-
Save herpdederp/34f15e923a2cece09c5acda0b5220211 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool inUse = false; | |
System.Net.NetworkInformation.IPGlobalProperties ipProperties = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties(); | |
System.Net.IPEndPoint[] ipEndPoints = ipProperties.GetActiveUdpListeners(); | |
foreach (System.Net.IPEndPoint endPoint in ipEndPoints) | |
{ | |
if (endPoint.Port == port) | |
{ | |
inUse = true; | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment