Пример #1
0
    public static void Main()
    {
        var binding = new NetPeerTcpBinding();

        binding.Resolver.Mode           = PeerResolverMode.Custom;
        binding.Resolver.Custom.Address = new EndpointAddress("net.tcp://localhost:8086");
        var tcp = new NetTcpBinding()
        {
            TransactionFlow = false
        };

        tcp.Security.Mode = SecurityMode.None;
        binding.Resolver.Custom.Binding = tcp;

        binding.Security.Mode = SecurityMode.None;
        IFooChannel proxy = new DuplexChannelFactory <IFooChannel> (
            new Foo(),
            binding,
            new EndpointAddress("net.p2p://samplemesh/SampleService")
            ).CreateChannel();

        proxy.Open();
        proxy.SendMessage("TEST FOR ECHO");
        Console.WriteLine(proxy.SessionId);
        Console.WriteLine("type [CR] to quit");
        Console.ReadLine();
    }
Пример #2
0
	public static void Main ()
	{
		var binding = new NetPeerTcpBinding ();
		binding.Resolver.Mode = PeerResolverMode.Custom;
		binding.Resolver.Custom.Address = new EndpointAddress ("net.tcp://localhost:8086");
		var tcp = new NetTcpBinding () { TransactionFlow = false };
		tcp.Security.Mode = SecurityMode.None;
		binding.Resolver.Custom.Binding = tcp;

		binding.Security.Mode = SecurityMode.None;
		IFooChannel proxy = new DuplexChannelFactory<IFooChannel> (
			new Foo (),
			binding,
			new EndpointAddress ("net.p2p://samplemesh/SampleService")
			).CreateChannel ();
		proxy.Open ();
		proxy.SendMessage ("TEST FOR ECHO");
		Console.WriteLine (proxy.SessionId);
		Console.WriteLine ("type [CR] to quit");
		Console.ReadLine ();
	}