summaryrefslogtreecommitdiff
path: root/testprogs/ejs/echo.js
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-02 11:13:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:19:05 -0500
commitf663c67c4e3fcb37db689d49957165fc6a25657b (patch)
treed1e107fbd25213839a4d33fe04740c154b9f18f5 /testprogs/ejs/echo.js
parent9331714787f663a1b46447598a7edf0ebff7d355 (diff)
downloadsamba-f663c67c4e3fcb37db689d49957165fc6a25657b.tar.gz
samba-f663c67c4e3fcb37db689d49957165fc6a25657b.tar.bz2
samba-f663c67c4e3fcb37db689d49957165fc6a25657b.zip
r8074: demonstrate calling echo_AddOne() from ejs
(This used to be commit 0c534699efb24abefd9879859cde6a9ac61e5af3)
Diffstat (limited to 'testprogs/ejs/echo.js')
-rw-r--r--testprogs/ejs/echo.js32
1 files changed, 18 insertions, 14 deletions
diff --git a/testprogs/ejs/echo.js b/testprogs/ejs/echo.js
index 6d01f69a5c..3ab2d9f0c6 100644
--- a/testprogs/ejs/echo.js
+++ b/testprogs/ejs/echo.js
@@ -9,26 +9,30 @@ function irpcObj()
return o;
}
-function test_AddOne()
+function test_AddOne(binding)
{
var status;
var conn = new Object();
var io = irpcObj();
- status = rpc_connect(conn, "ncacn_ip_tcp:localhost", "rpcecho");
- printVars(status);
- printVars(conn);
-
- io.in.in_data = 3;
- status = rpc_call(conn, "echo_AddOne", io);
- printVars(status);
- printVars(io);
+ status = rpc_connect(conn, binding, "rpcecho");
+ if (status.is_ok != true) {
+ print("Failed to connect to " + binding + " - " + status.errstr + "\n");
+ return;
+ }
+
+ for (i=0;i<10;i++) {
+ io.in.in_data = i;
+ status = rpc_call(conn, "echo_AddOne", io);
+ print("AddOne(" + i + ")=" + io.out.out_data + "\n");
+ }
}
+if (ARGV.length == 0) {
+ print("Usage: echo.js <RPCBINDING>\n");
+ exit(0);
+}
-print("Starting\n");
-
-test_AddOne();
-
-
+var binding = ARGV[0];
+test_AddOne(binding);