示例#1
0
 internal override IRemotingEndPoint CreateClient(string name = null,
                                                  IAuthenticator clientAuthenticator  = null,
                                                  IAuthenticator serverAuthenticator  = null,
                                                  LatencySettings latencySettings     = null,
                                                  HeartbeatSettings heartbeatSettings = null,
                                                  NetworkServiceDiscoverer networkServiceDiscoverer = null)
 {
     return(new SocketEndPoint(EndPointType.Client,
                               name, clientAuthenticator, serverAuthenticator, networkServiceDiscoverer: null,
                               latencySettings: latencySettings,
                               heartbeatSettings: heartbeatSettings));
 }
示例#2
0
 internal override IRemotingEndPoint CreateServer(string name = null, IAuthenticator clientAuthenticator = null,
                                                  IAuthenticator serverAuthenticator  = null,
                                                  LatencySettings latencySettings     = null,
                                                  EndPointSettings endPointSettings   = null,
                                                  HeartbeatSettings heartbeatSettings = null,
                                                  NetworkServiceDiscoverer networkServiceDiscoverer = null)
 {
     return(new NamedPipeRemotingEndPointServer(name,
                                                clientAuthenticator,
                                                serverAuthenticator,
                                                heartbeatSettings: heartbeatSettings,
                                                latencySettings: latencySettings));
 }
示例#3
0
        public void TestFindServices6()
        {
            var payload = Encoding.UTF8.GetBytes("Version 5, Protocol 120");

            using (var registry = new NetworkServiceDiscoverer(sendLegacyResponse: true))
                using (registry.RegisterService("MyAwesomeWebApplication",
                                                new IPEndPoint(IPAddress.Parse("19.87.0.12"), port: 15431), payload))
                {
                    var services = _discoverer.FindServices("MyAwesomeWebApplication");
                    services.Should().NotBeNull();
                    services.Should().NotBeEmpty();
                    foreach (var service in services)
                    {
                        service.Name.Should().Be("MyAwesomeWebApplication");
                        service.Payload.Should().Equal(payload);
                    }
                }
        }
示例#4
0
        public static int Run(CommandLineOptions options)
        {
            var machineName = Environment.MachineName;
            var serviceName = $"{machineName}.DPloy.Node";

            using (var discoverer = new NetworkServiceDiscoverer(new NetworkServiceDiscoverySettings
            {
                Port = Constants.NetworkServiceDiscoveryPort
            }))
                using (var node = new NodeServer(serviceName, discoverer, options.AllowedHosts))
                {
                    node.Bind(new IPEndPoint(IPAddress.Any, Constants.ConnectionPort));

                    Console.WriteLine("Waiting for incoming connections (you can write exit to end the program)...");

                    WaitUntilExit();
                }

            return(0);
        }
示例#5
0
        public void TestTryConnect23()
        {
            using (var discoverer = new NetworkServiceDiscoverer())
                using (var client = CreateClient("Rep1", networkServiceDiscoverer: discoverer))
                    using (var server = CreateServer("Rep2", networkServiceDiscoverer: discoverer))
                    {
                        Bind(server);

                        client.IsConnected.Should().BeFalse();
                        client.RemoteEndPoint.Should().BeNull();

                        server.IsConnected.Should().BeFalse();
                        server.RemoteEndPoint.Should().BeNull();

                        TryConnect(client, server.Name, TimeSpan.FromSeconds(value: 10))
                        .Should().BeTrue();

                        client.IsConnected.Should().BeTrue();
                        client.RemoteEndPoint.Should().Be(server.LocalEndPoint);

                        server.IsConnected.Should().BeTrue();
                    }
        }
 internal abstract IRemotingEndPoint CreateServer(string name = null, IAuthenticator clientAuthenticator = null, IAuthenticator serverAuthenticator = null, LatencySettings latencySettings = null, EndPointSettings endPointSettings = null, HeartbeatSettings heartbeatSettings = null, NetworkServiceDiscoverer networkServiceDiscoverer = null);
示例#7
0
 public void TestFixtureSetUp()
 {
     _discoverer = new NetworkServiceDiscoverer();
 }