HttpListener::IsListening Property
.NET Framework (current version)
Gets a value that indicates whether HttpListener has been started.
Assembly: System (in System.dll)
To start an HttpListener, call the Start method.
The following code example demonstrates using this property to determine the listening state of an instance.
public static void DisplayPrefixesAndState(HttpListener listener) { // List the prefixes to which the server listens. HttpListenerPrefixCollection prefixes = listener.Prefixes; if (prefixes.Count == 0) { Console.WriteLine("There are no prefixes."); } foreach(string prefix in prefixes) { Console.WriteLine(prefix); } // Show the listening state. if (listener.IsListening) { Console.WriteLine("The server is listening."); } }
.NET Framework
Available since 2.0
Available since 2.0
Show: