diff --git a/Pilz.Net/Api/ApiServer.cs b/Pilz.Net/Api/ApiServer.cs index b98e4d6..425124a 100644 --- a/Pilz.Net/Api/ApiServer.cs +++ b/Pilz.Net/Api/ApiServer.cs @@ -80,7 +80,8 @@ public class ApiServer(string apiUrl) : IApiServer protected void Receive() { - httpListener?.BeginGetContext(ListenerCallback, null); + if (httpListener.IsListening) + httpListener?.BeginGetContext(ListenerCallback, null); } protected void ListenerCallback(IAsyncResult result)