private bool StartPeer()
        {
            _peer = Pyro.Network.Create.NewPeer(ListenPort);
            //_peer.OnReceivedRequest += (server, client, text) => WriteConsole(ELogLevel.Verbose, text);

            _peer.OnWrite            += (t, c) => WriteConsole(ELogLevel.Info, t);
            _peer.OnReceivedRequest  += _peer_OnReceivedRequest;
            _peer.OnReceivedResponse += _peer_OnReceivedResponse;
            _peer.OnConnected        += PeerOnOnConnected;

            return(_peer.SelfHost() || Error("Failed to start local server"));
        }
예제 #2
0
        private bool StartPeer(string[] args)
        {
            var port = ListenPort;

            if (args.Length == 1 && !int.TryParse(args[0], out port))
            {
                return(Error($"Local server listen port number expected as argument, got {args[0]}"));
            }

            _peer = Create.NewPeer(port);
            var ctx   = _peer.Local.Context;
            var reg   = ctx.Registry;
            var scope = ctx.Executor.Scope;

            reg.Register(new ClassBuilder <TestClient>(reg).Class);
            scope["remote"] = new TestClient();

            return(_peer.SelfHost() || Error("Failed to start local server"));
        }