diff --git a/TestApp/MyService.cs b/TestApp/MyService.cs index 6d2c2f8..a127697 100644 --- a/TestApp/MyService.cs +++ b/TestApp/MyService.cs @@ -1,4 +1,5 @@ using System; +using System.Net; using ZeroLevel; using ZeroLevel.Services.Applications; @@ -15,7 +16,10 @@ namespace TestApp protected override void StartAction() { Log.Info("Started"); - Sheduller.RemindEvery(TimeSpan.FromSeconds(5), () => Log.Info("Still alive")); + Sheduller.RemindEvery(TimeSpan.FromSeconds(5), () => { + var client = ConnectToService(new IPEndPoint(IPAddress.Loopback, 8800)); + client.Request("upper", "hello", s => Log.Info(s)); + }); } protected override void StopAction() diff --git a/TestApp/Program.cs b/TestApp/Program.cs index e265260..2a0bcfe 100644 --- a/TestApp/Program.cs +++ b/TestApp/Program.cs @@ -15,10 +15,7 @@ namespace TestApp .Run(); var router = se.Service.UseHost(8800); - router.RegisterInbox("upper", (c, s) => s.ToUpperInvariant()); - - var client = se.Service.ConnectToService(new IPEndPoint(IPAddress.Loopback, 8800)); - client.Request("upper", "hello", s => Console.WriteLine(s)); + router.RegisterInbox("upper", (c, s) => s.ToUpperInvariant()); se.WaitWhileStatus(ZeroServiceStatus.Running) .Stop(); diff --git a/ZeroLevel/Services/BaseZeroService.cs b/ZeroLevel/Services/BaseZeroService.cs index 1775f35..9b667b8 100644 --- a/ZeroLevel/Services/BaseZeroService.cs +++ b/ZeroLevel/Services/BaseZeroService.cs @@ -137,7 +137,7 @@ namespace ZeroLevel.Services.Applications { if (_state == ZeroServiceStatus.Running) { - return GetServer(new IPEndPoint(NetUtils.GetNonLoopbackAddress(), NetUtils.GetFreeTcpPort()), new Router()).Router; + return GetServer(new IPEndPoint(IPAddress.Any, NetUtils.GetFreeTcpPort()), new Router()).Router; } return _null_router; } @@ -146,7 +146,7 @@ namespace ZeroLevel.Services.Applications { if (_state == ZeroServiceStatus.Running) { - return GetServer(new IPEndPoint(NetUtils.GetNonLoopbackAddress(), port), new Router()).Router; + return GetServer(new IPEndPoint(IPAddress.Any, port), new Router()).Router; } return _null_router; }