pull/1/head
unknown 5 years ago
parent 4e568df6d6
commit 1f8ebb36d5

@ -1,4 +1,5 @@
using System; using System;
using System.Net;
using ZeroLevel; using ZeroLevel;
using ZeroLevel.Services.Applications; using ZeroLevel.Services.Applications;
@ -15,7 +16,10 @@ namespace TestApp
protected override void StartAction() protected override void StartAction()
{ {
Log.Info("Started"); 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<string, string>("upper", "hello", s => Log.Info(s));
});
} }
protected override void StopAction() protected override void StopAction()

@ -15,10 +15,7 @@ namespace TestApp
.Run(); .Run();
var router = se.Service.UseHost(8800); var router = se.Service.UseHost(8800);
router.RegisterInbox<string, string>("upper", (c, s) => s.ToUpperInvariant()); router.RegisterInbox<string, string>("upper", (c, s) => s.ToUpperInvariant());
var client = se.Service.ConnectToService(new IPEndPoint(IPAddress.Loopback, 8800));
client.Request<string, string>("upper", "hello", s => Console.WriteLine(s));
se.WaitWhileStatus(ZeroServiceStatus.Running) se.WaitWhileStatus(ZeroServiceStatus.Running)
.Stop(); .Stop();

@ -137,7 +137,7 @@ namespace ZeroLevel.Services.Applications
{ {
if (_state == ZeroServiceStatus.Running) 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; return _null_router;
} }
@ -146,7 +146,7 @@ namespace ZeroLevel.Services.Applications
{ {
if (_state == ZeroServiceStatus.Running) 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; return _null_router;
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.