Private Function IsPortOpen(ByVal Host As String, ByVal PortNumber As Integer) As Boolean
Dim Client As TcpClient = Nothing
Try
Client = New TcpClient(Host, PortNumber)
Return True
Catch ex As SocketException
Return False
Finally
If Not Client Is Nothing Then
Client.Close()
End If
End Try
End Function