1. ' Check if Server Port is available
  2. Dim isPortAvailable As Boolean = True
  3.  
  4. Dim ipGlobalProp As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()
  5. Dim ipEndPt() As IPEndPoint = ipGlobalProp.GetActiveTcpListeners
  6.  
  7. For Each tcpListeners As IPEndPoint In ipEndPt
  8. If tcpListeners.Port = ServerPort Then
  9. isPortAvailable = False
  10. Exit For
  11. End If
  12. Next
  13.  
  14. If isPortAvailable = False Then
  15. ' Connection already open on Server Port
  16. InvokeUpdateServerStatus("[ERROR] Connection Already Open on TCP Port: " & ServerPort)
  17.  
  18. Else
  19. ' Enable Start Server Button
  20. InvokeButtonStartServer(True)
  21. InvokeUpdateServerStatus("[INFO] Server Ready to Start...")
  22. End If