public static void Run(string[] args) { int status = 0; try { using (Ice.Communicator ic = Ice.Util.initialize(ref args)) { Ice.ObjectPrx obj = ic.stringToProxy("SimplePrinter:default -p 10000"); PrinterPrx printer = PrinterPrxHelper.checkedCast(obj); if (printer == null) { Console.WriteLine("Invalid proxy"); } printer.printString("Hello ice"); Console.WriteLine("send ok"); Console.WriteLine("press any key to continue"); Console.Read(); } } catch (Exception ex) { Console.Error.WriteLine(ex); status = 1; } Environment.Exit(status); }
public override int run(string[] args) { ObjectPrx proxy = communicator().stringToProxy(args[0]); PrinterPrx printer = PrinterPrxHelper.checkedCast(proxy); printer.write("Hello, World!"); return(0); }
public override int run(string[] args) { var proxy = PrinterPrxHelper.checkedCast(communicator().propertyToProxy("Print.Proxy")); if (proxy == null) { Console.Error.WriteLine("invalid proxy"); return(1); } menu(); string line = null; do { line = Console.In.ReadLine(); if (line == "i") { proxy.printString("马上发"); Console.WriteLine("马上发"); } else if (line == "d") { proxy.begin_printString("延时发").whenCompleted(() => { Console.WriteLine("异步发"); }, (Ice.Exception ex) => { }); } else if (line == "p") { var buffer = File.ReadAllBytes("f:\\a.jpg"); Stopwatch sw = Stopwatch.StartNew(); proxy.sendImage(buffer, "car"); sw.Stop(); Console.WriteLine("发送成功->" + sw.ElapsedMilliseconds); } else if (line == "s") { proxy.printString("s"); Console.Out.WriteLine("s"); } } while (!(line == "x")); proxy.printString("app exuecte"); return(0); }
internal InitialI(Ice.ObjectAdapter adapter) { _simple = new Simple(); _simple.message = "a message 4 u"; _printer = new PrinterI(); _printer.message = "Ice rulez!"; _printerProxy = PrinterPrxHelper.uncheckedCast(adapter.addWithUUID(_printer)); _derivedPrinter = new DerivedPrinterI(); _derivedPrinter.message = _printer.message; _derivedPrinter.derivedMessage = "a derived message 4 u"; adapter.addWithUUID(_derivedPrinter); }
public override int run(string[] args) { PrinterPrx printer = PrinterPrxHelper.checkedCast(communicator().propertyToProxy("Callback.CallbackServer")); if (printer == null) { System.Console.WriteLine("网络配置无效!"); return(1); } string str = "Hello world"; while (!string.IsNullOrEmpty(str)) { printer.PrintString(str); str = Console.ReadLine(); } return(0); }
static int Main(string[] args) { try { using (Ice.Communicator communicator = Ice.Util.initialize(ref args)) { var obj = communicator.stringToProxy("SimplePrinter:default -h localhost -p 10000"); var printer = PrinterPrxHelper.checkedCast(obj); if (printer == null) { throw new ApplicationException("Invalid proxy"); } printer.printString("Hello World!"); } } catch (Exception e) { Console.Error.WriteLine(e); return(1); } return(0); }
public static int Main(string[] args) { int status = 0; Ice.Communicator ic = null; try { ic = Ice.Util.initialize(ref args); var obj = ic.stringToProxy("SimplePrinter:default -h localhost -p 10000"); var printer = PrinterPrxHelper.checkedCast(obj); if (printer == null) { throw new ApplicationException("Invalid proxy"); } printer.printString("Hello World!"); } catch (Exception e) { Console.Error.WriteLine(e); status = 1; } if (ic != null) { try { ic.destroy(); } catch (Exception e) { Console.Error.WriteLine(e); status = 1; } } return(status); }