Esempio n. 1
0
  public static void Main (string[] args) {
    Node n = BuildExpr();

    if (args.Length != 1) {
      Console.WriteLine ("Specify 'server' or 'client' as first argument");
      return;
    }

    if (args[0] == "client") {
      Ice.IceClientChannel ic = new Ice.IceClientChannel();
      ChannelServices.RegisterChannel (ic);

      NodeEvaluator ne = (NodeEvaluator) Activator.GetObject (typeof (NodeEvaluator),
							      "ice://localhost:10000/ne");

      int res = ne.EvalNode (n);
      Console.WriteLine ("Result: {0}", res);
    } else if (args[0] == "server") {
      Ice.IceChannel ic = new Ice.IceChannel(10000);
      ChannelServices.RegisterChannel (ic);

      RemotingConfiguration.RegisterWellKnownServiceType (typeof (NodeEvaluatorI),
							  "ne",
							  WellKnownObjectMode.Singleton);
      Console.ReadLine();
    }
  }
Esempio n. 2
0
    public static void Main()
    {
        Ice.IceClientChannel icc = new Ice.IceClientChannel();
        ChannelServices.RegisterChannel(icc);

        Hello h = (Hello)Activator.GetObject(typeof(Hello), "ice://localhost:10000/hello");

        string[] ids = h.ice_ids();
        foreach (string id in ids)
        {
            Console.WriteLine(id);
        }

        helloDelegate hd = new helloDelegate(h.sayHello);

        string[]     who = { ".NET", "Mono", "C#" };
        IAsyncResult ar  = hd.BeginInvoke(who, null, null);

        Console.WriteLine("Waiting");
        ar.AsyncWaitHandle.WaitOne();
        int ret = hd.EndInvoke(ar);

        //    int ret = h.sayHello(who);
        Console.WriteLine("Said " + ret + " hellos.");
    }
Esempio n. 3
0
 public IceChannel(int port)
 {
     Ice.TcpEndpoint te = new Ice.TcpEndpoint("localhost", port);
     te.Incoming = true;
     _svrChannel = new IceServerChannel(te);
     _cltChannel = new IceClientChannel();
 }
Esempio n. 4
0
    public static void Main(string[] args)
    {
        Node n = BuildExpr();

        if (args.Length != 1)
        {
            Console.WriteLine("Specify 'server' or 'client' as first argument");
            return;
        }

        if (args[0] == "client")
        {
            Ice.IceClientChannel ic = new Ice.IceClientChannel();
            ChannelServices.RegisterChannel(ic);

            NodeEvaluator ne = (NodeEvaluator)Activator.GetObject(typeof(NodeEvaluator),
                                                                  "ice://localhost:10000/ne");

            int res = ne.EvalNode(n);
            Console.WriteLine("Result: {0}", res);
        }
        else if (args[0] == "server")
        {
            Ice.IceChannel ic = new Ice.IceChannel(10000);
            ChannelServices.RegisterChannel(ic);

            RemotingConfiguration.RegisterWellKnownServiceType(typeof(NodeEvaluatorI),
                                                               "ne",
                                                               WellKnownObjectMode.Singleton);
            Console.ReadLine();
        }
    }
Esempio n. 5
0
  public static void Main () {
    Ice.IceClientChannel icc = new Ice.IceClientChannel ();
    ChannelServices.RegisterChannel (icc);

    Ping p = (Ping) Activator.GetObject (typeof (Ping), "ice://localhost:10000/ping");

    p.ice_ping();

    int start = Environment.TickCount;

    for (int i = 0; i < 100000; i++) {
      p.ice_ping();
    }

    int end = Environment.TickCount;

    Console.WriteLine ("100000 pings took: {0}", ((float) (end - start)) / 1000.0f);
  }
Esempio n. 6
0
    public static void Main()
    {
        Ice.IceClientChannel icc = new Ice.IceClientChannel();
        ChannelServices.RegisterChannel(icc);

        Ping p = (Ping)Activator.GetObject(typeof(Ping), "ice://localhost:10000/ping");

        p.ice_ping();

        int start = Environment.TickCount;

        for (int i = 0; i < 100000; i++)
        {
            p.ice_ping();
        }

        int end = Environment.TickCount;

        Console.WriteLine("100000 pings took: {0}", ((float)(end - start)) / 1000.0f);
    }
Esempio n. 7
0
  public static void Main () {
    Ice.IceClientChannel icc = new Ice.IceClientChannel ();
    ChannelServices.RegisterChannel (icc);

    Hello h = (Hello) Activator.GetObject (typeof (Hello), "ice://localhost:10000/hello");

    string[] ids = h.ice_ids();
    foreach (string id in ids) {
      Console.WriteLine (id);
    }

    helloDelegate hd = new helloDelegate (h.sayHello);

    string[] who = {".NET", "Mono", "C#"};
    IAsyncResult ar = hd.BeginInvoke (who, null, null);
    Console.WriteLine ("Waiting");
    ar.AsyncWaitHandle.WaitOne();
    int ret = hd.EndInvoke (ar);
    //    int ret = h.sayHello(who);
    Console.WriteLine ("Said " + ret + " hellos.");
  }
Esempio n. 8
0
 public IceChannel(int port) {
   Ice.TcpEndpoint te = new Ice.TcpEndpoint ("localhost", port);
   te.Incoming = true;
   _svrChannel = new IceServerChannel (te);
   _cltChannel = new IceClientChannel ();
 }