public override HelloPrx createHello(Ice.Current c) { lock (this) { if (_destroy) { throw new Ice.ObjectNotExistException(); } var hello = HelloPrxHelper.uncheckedCast(c.adapter.addWithUUID(new HelloI(_name, _nextId++))); _objs.Add(hello); return(hello); } }
public static int Main(string[] args) { int status = 0; try { // // The new communicator is automatically destroyed (disposed) at the end of the // using statement // using (var communicator = Ice.Util.initialize(ref args, "config.client")) { // // Destroy the communicator on Ctrl+C or Ctrl+Break // Console.CancelKeyPress += (sender, eventArgs) => communicator.destroy(); // // The communicator initialization removes all Ice-related arguments from args // if (args.Length > 0) { Console.Error.WriteLine("too many arguments"); status = 1; } else { var hello = HelloPrxHelper.uncheckedCast(communicator.propertyToProxy("Hello.Proxy")); if (hello == null) { Console.Error.WriteLine("Hello.Proxy not found"); status = 1; } else { hello.sayHello(); } } } } catch (Exception ex) { Console.Error.WriteLine(ex); status = 1; } return(status); }
public override int run(string[] args) { if (args.Length > 0) { Console.Error.WriteLine(appName() + ": too many arguments"); return(1); } HelloPrx hello = HelloPrxHelper.uncheckedCast(communicator().propertyToProxy("Hello.Proxy")); if (hello == null) { Console.Error.WriteLine("Hello.Proxy not found"); return(1); } hello.sayHello(); return(0); }
public override HelloPrx getReplicatedHello(Ice.Current current) { return(HelloPrxHelper.uncheckedCast(_adapter1.createProxy( Ice.Util.stringToIdentity("hello")))); }
private static int run(Ice.Communicator communicator) { var twoway = HelloPrxHelper.checkedCast( communicator.propertyToProxy("Hello.Proxy").ice_twoway().ice_timeout(-1).ice_secure(false)); if (twoway == null) { Console.Error.WriteLine("invalid proxy"); return(1); } var oneway = HelloPrxHelper.uncheckedCast(twoway.ice_oneway()); var batchOneway = HelloPrxHelper.uncheckedCast(twoway.ice_batchOneway()); var datagram = HelloPrxHelper.uncheckedCast(twoway.ice_datagram()); var batchDatagram = HelloPrxHelper.uncheckedCast(twoway.ice_batchDatagram()); bool secure = false; menu(); string line = null; do { try { Console.Out.Write("==> "); Console.Out.Flush(); line = Console.In.ReadLine(); if (line == null) { break; } if (line.Equals("t")) { twoway.sayHello(); } else if (line.Equals("o")) { oneway.sayHello(); } else if (line.Equals("O")) { batchOneway.sayHello(); } else if (line.Equals("d")) { if (secure) { Console.WriteLine("secure datagrams are not supported"); } else { datagram.sayHello(); } } else if (line.Equals("D")) { if (secure) { Console.WriteLine("secure datagrams are not supported"); } else { batchDatagram.sayHello(); } } else if (line.Equals("f")) { batchOneway.ice_flushBatchRequests(); batchDatagram.ice_flushBatchRequests(); } else if (line.Equals("S")) { secure = !secure; twoway = HelloPrxHelper.uncheckedCast(twoway.ice_secure(secure)); oneway = HelloPrxHelper.uncheckedCast(oneway.ice_secure(secure)); batchOneway = HelloPrxHelper.uncheckedCast(batchOneway.ice_secure(secure)); datagram = HelloPrxHelper.uncheckedCast(datagram.ice_secure(secure)); batchDatagram = HelloPrxHelper.uncheckedCast(batchDatagram.ice_secure(secure)); if (secure) { Console.WriteLine("secure mode is now on"); } else { Console.WriteLine("secure mode is now off"); } } else if (line.Equals("x")) { // Nothing to do } else if (line.Equals("?")) { menu(); } else { Console.WriteLine("unknown command `" + line + "'"); menu(); } } catch (Exception ex) { Console.Error.WriteLine(ex); } }while (!line.Equals("x")); return(0); }
public override HelloPrx getHello(Ice.Current current) { return(HelloPrxHelper.uncheckedCast(_adapter1.createIndirectProxy( _adapter1.getCommunicator().stringToIdentity("hello")))); }
public override int run(string[] args) { if (args.Length > 0) { Console.Error.WriteLine(appName() + ": too many arguments"); return(1); } try { communicator().getPluginManager().getPlugin("IceSSL"); _haveSSL = true; } catch (Ice.NotRegisteredException) { } var twoway = HelloPrxHelper.checkedCast( communicator().propertyToProxy("Hello.Proxy").ice_twoway().ice_timeout(-1).ice_secure(false)); if (twoway == null) { Console.Error.WriteLine("invalid proxy"); return(1); } var oneway = HelloPrxHelper.uncheckedCast(twoway.ice_oneway()); var batchOneway = HelloPrxHelper.uncheckedCast(twoway.ice_batchOneway()); var datagram = HelloPrxHelper.uncheckedCast(twoway.ice_datagram()); var batchDatagram = HelloPrxHelper.uncheckedCast(twoway.ice_batchDatagram()); bool secure = false; menu(); string line = null; do { try { Console.Out.Write("==> "); Console.Out.Flush(); line = Console.In.ReadLine(); if (line == null) { break; } if (line.Equals("t")) { twoway.sayHello(); } else if (line.Equals("o")) { oneway.sayHello(); } else if (line.Equals("O")) { batchOneway.sayHello(); } else if (line.Equals("d")) { if (secure) { Console.WriteLine("secure datagrams are not supported"); } else { datagram.sayHello(); } } else if (line.Equals("D")) { if (secure) { Console.WriteLine("secure datagrams are not supported"); } else { batchDatagram.sayHello(); } } else if (line.Equals("f")) { batchOneway.ice_flushBatchRequests(); batchDatagram.ice_flushBatchRequests(); } else if (_haveSSL && line.Equals("S")) { secure = !secure; twoway = HelloPrxHelper.uncheckedCast(twoway.ice_secure(secure)); oneway = HelloPrxHelper.uncheckedCast(oneway.ice_secure(secure)); batchOneway = HelloPrxHelper.uncheckedCast(batchOneway.ice_secure(secure)); datagram = HelloPrxHelper.uncheckedCast(datagram.ice_secure(secure)); batchDatagram = HelloPrxHelper.uncheckedCast(batchDatagram.ice_secure(secure)); if (secure) { Console.WriteLine("secure mode is now on"); } else { Console.WriteLine("secure mode is now off"); } } else if (line.Equals("x")) { // Nothing to do } else if (line.Equals("?")) { menu(); } else { Console.WriteLine("unknown command `" + line + "'"); menu(); } } catch (Exception ex) { Console.Error.WriteLine(ex); } }while (!line.Equals("x")); return(0); }