예제 #1
0
        static void Main(string[] args)
        {

            HproseClient client = HproseClient.Create("tcp4://127.0.0.1:4321/");
            hello = client.UseService<IHello>();
            Console.WriteLine("TCP");
            Console.WriteLine(hello.Hello("World"));
            Test("World");
            Test("".PadRight(512, '$'));
            Test("".PadRight(1024, '$'));
            Test("".PadRight(2 * 1024, '$'));
            Test("".PadRight(4 * 1024, '$'));
            Test("".PadRight(8 * 1024, '$'));
            Test("".PadRight(16 * 1024, '$'));
            Test("".PadRight(32 * 1024, '$'));
            Test("".PadRight(64 * 1024, '$'));

            client = HproseClient.Create("http://localhost:8888/");
            hello = client.UseService<IHello>();
            Console.WriteLine("HTTP");
            Console.WriteLine(hello.Hello("World"));
            Test("World");
            Test("".PadRight(512, '$'));
            Test("".PadRight(1024, '$'));
            Test("".PadRight(2 * 1024, '$'));
            Test("".PadRight(4 * 1024, '$'));
            Test("".PadRight(8 * 1024, '$'));
            Test("".PadRight(16 * 1024, '$'));
            Test("".PadRight(32 * 1024, '$'));
            Test("".PadRight(64 * 1024, '$'));
            Console.ReadKey();

//            client.Invoke<string>("hello", new Object[] { "Async World" }, result => Console.WriteLine(result));

        }
예제 #2
0
 private static TimeSpan Run(string name, TimeSpan baseTime, IHello hello)
 {
     var sw = Stopwatch.StartNew();
     for (int i = 0; i < Iterations; i++)
     {
         hello.Hello();
     }
     var time = sw.Elapsed;
     Console.WriteLine(name + ": " + time + ", slowdown: " + time.TotalMilliseconds / baseTime.TotalMilliseconds);
     return time;
 }
예제 #3
0
 static void Main(string[] args)
 {
     client = new XRPCClient("localhost", 9090);
     client.Options.ParameterFormater = new JsonPacket();//default messagepack
     hello = client.Create <IHello>();
     while (true)
     {
         Console.Write("Enter you name:");
         var name = Console.ReadLine();
         var task = hello.Hello(name);
         task.Wait();
         Console.WriteLine(task.Result);
     }
     Console.Read();
 }
예제 #4
0
        static void Call(ChannelFactory <IHello> factory, string address, Uri serviceVia)
        {
            IHello channel = factory.CreateChannel(new EndpointAddress(address), serviceVia);

            try
            {
                string reply = channel.Hello();
                Console.WriteLine(reply.ToString());
                ((IClientChannel)channel).Close();
            }
            catch (CommunicationException ce)
            {
                Console.WriteLine("Exception: {0}", ce.Message);
                ((IClientChannel)channel).Abort();
            }
        }
예제 #5
0
        static void Main()
        {
            TcpChannel channel = new TcpChannel();

            ChannelServices.RegisterChannel(channel, true);

            IHello obj = (IHello)Activator.GetObject(
                typeof(IHello),
                "tcp://localhost:8086/HelloService");

            if (obj == null)
            {
                System.Console.WriteLine("Could not locate server");
            }
            else
            {
                Console.WriteLine(obj.Hello());
            }
            Console.ReadLine();
        }
예제 #6
0
 public void Execute(JobContext context)
 {
     Console.WriteLine(hello.Hello("World"));
 }