Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
await session.say(message);
}
}
}
let communicator:Ice.Communicator;
try
{
//
// Initialize the communicator with Ice.Default.Router property
// set to the simple chat demo Glacier2 router.
//
const initData = new Ice.InitializationData();
initData.properties = Ice.createProperties();
initData.properties.setProperty("Ice.Default.Router", "DemoGlacier2/router:tcp -p 4063 -h localhost");
communicator = Ice.initialize(process.argv, initData);
const router = await Glacier2.RouterPrx.checkedCast(communicator.getDefaultRouter());
const session = await createSession(router);
await runWithSession(router, session);
}
catch(ex)
{
console.log(ex.toString());
process.exitCode = 1;
}
finally
{
if(communicator)
{
await communicator.destroy();
}
else
{
const file = Filesystem.FilePrx.uncheckedCast(node);
const text = await file.read();
for(const line of text)
{
console.log(`${indent}\t${line}`);
}
}
}
}
let communicator:Ice.Communicator;
try
{
communicator = Ice.initialize(process.argv);
if(process.argv.length > 2)
{
throw new Error("too many arguments");
}
//
// Create a proxy for the root directory
//
const base = communicator.stringToProxy("RootDir:default -h localhost -p 10000");
//
// Down-cast the proxy to a directory proxy
//
const rootDir = await Filesystem.DirectoryPrx.checkedCast(base);
if(!rootDir)
{
(async function()
{
let communicator;
try
{
communicator = Ice.initialize(process.argv);
//
// Down-cast the proxy to the hello object interface and invoke
// the sayHello method.
//
const hello = await Demo.HelloPrx.checkedCast(communicator.stringToProxy("hello:tcp -h localhost -p 10000"));
await hello.sayHello();
}
catch(ex)
{
console.log(ex.toString());
process.exitCode = 1;
}
finally
{
if(communicator)
{
(async () =>
{
let communicator:Ice.Communicator;
try
{
communicator = Ice.initialize(process.argv);
//
// Down-cast the proxy to the hello object interface and invoke
// the sayHello method.
//
const hello = await Demo.HelloPrx.checkedCast(communicator.stringToProxy("hello:tcp -h localhost -p 10000"));
await hello.sayHello();
}
catch(ex)
{
console.log(ex.toString());
process.exitCode = 1;
}
finally
{
if(communicator)
{
{
routerConfig = data['Ice.Default.Router'];
}
else
{
throw new Error('Ice.Default.Router not in config file');
}
//
// Initialize the communicator with the Ice.Default.Router property
// provided by 'config.json'
//
const initData = new Ice.InitializationData();
initData.properties = Ice.createProperties();
initData.properties.setProperty("Ice.Default.Router", routerConfig);
communicator = Ice.initialize(initData);
//
// Get a proxy to the Glacier2 router using checkedCast to ensure
// the Glacier2 server is available.
//
const router = await RouterPrx.checkedCast(communicator.getDefaultRouter());
//
// Create a session with the Glacier2 router.
//
const username = $("#username").val() as string;
const password = $("#password").val() as string;
const session = await router.createSession(username, password);
await run(router, ChatSessionPrx.uncheckedCast(session));
}
catch(ex)
stringSeq[i] = "hello";
}
const structSeq:Demo.StringDoubleSeq = [];
for(let i = 0; i < Demo.StringDoubleSeqSize; ++i)
{
structSeq[i] = new Demo.StringDouble("hello", 3.14);
}
const fixedSeq:Demo.FixedSeq = [];
for(let i = 0; i < Demo.FixedSeqSize; ++i)
{
fixedSeq[i] = new Demo.Fixed(0, 0, 0);
}
const communicator = Ice.initialize();
//
// Handle the client state.
//
enum State
{
Idle,
Running
};
let state:State;
//
// Run the throughput test.
//
async function run()
(() =>
{
//
// Handle the client state.
//
enum State
{
Idle,
Running
}
//
// Initialize the communicator
//
const communicator = Ice.initialize();
//
// Run the latency test.
//
async function run()
{
const hostname = document.location.hostname || "127.0.0.1";
const secure = document.location.protocol.indexOf("https") != -1;
const ref = secure ?
`ping:wss -h ${hostname} -p 9090 -r /demowss` :
`ping:ws -h ${hostname} -p 8080 -r /demows`;
const repetitions = 1000;
//
// Create a proxy to the ping object and down-cast the proxy
(async () =>
{
let communicator;
try
{
communicator = Ice.initialize();
const base = communicator.stringToProxy("SimplePrinter:default -p 10000");
const printer = await Demo.PrinterPrx.checkedCast(base);
if(printer)
{
await printer.printString("Hello World!");
}
else
{
console.log("Invalid proxy");
}
}
catch(ex)
{
console.log(ex.toString());
process.exitCode = 1;
}
(async () =>
{
let communicator:Ice.Communicator;
try
{
communicator = Ice.initialize(process.argv);
if(process.argv.length > 2)
{
throw new Error("too many arguments");
}
const proxy = communicator.stringToProxy("hello:default -p 10000").ice_twoway().ice_secure(false);
let timeout = -1;
let delay = 0;
let twoway = await Demo.HelloPrx.checkedCast(proxy);
let oneway = twoway.ice_oneway();
let batchOneway = twoway.ice_batchOneway();
menu();
let line = null;
(async function()
{
let communicator;
try
{
communicator = Ice.initialize(process.argv);
if(process.argv.length > 2)
{
throw new Error("too many arguments");
}
let proxy = communicator.stringToProxy("hello:default -p 10000").ice_twoway().ice_secure(false);
let timeout = -1;
let delay = 0;
let twoway = await Demo.HelloPrx.checkedCast(proxy);
let oneway = twoway.ice_oneway();
let batchOneway = twoway.ice_batchOneway();
menu();
let line = null;