r8074: demonstrate calling echo_AddOne() from ejs
authorAndrew Tridgell <tridge@samba.org>
Sat, 2 Jul 2005 11:13:12 +0000 (11:13 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:19:05 +0000 (13:19 -0500)
testprogs/ejs/echo.js

index 6d01f69a5c4ab42226a1ef76ec658468f8ed9e56..3ab2d9f0c685b86e803235cbc116679fcf22dfc1 100644 (file)
@@ -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);