diff --git a/Pilz.Net/Api/ApiServer.cs b/Pilz.Net/Api/ApiServer.cs index b02a64c..ce30082 100644 --- a/Pilz.Net/Api/ApiServer.cs +++ b/Pilz.Net/Api/ApiServer.cs @@ -26,6 +26,8 @@ public class ApiServer(string apiUrl) : IApiServer public bool DebugMode { get; set; } + public bool AllowMultipleRequests { get; set; } + public virtual void Start() { Log.Info("Start listening"); @@ -98,7 +100,8 @@ public class ApiServer(string apiUrl) : IApiServer } // Immitatly listen for new request - Receive(); + if (AllowMultipleRequests) + Receive(); // Check context try @@ -111,6 +114,10 @@ public class ApiServer(string apiUrl) : IApiServer if (DebugMode) throw; } + + // Listen for new request + if (!AllowMultipleRequests) + Receive(); } protected virtual void CheckContext(HttpListenerContext context)