forked from koding/koding
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.js
More file actions
executable file
·30 lines (26 loc) · 788 Bytes
/
Copy pathclient.js
File metadata and controls
executable file
·30 lines (26 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env node
// Connect to the auth server and display a quote from it.
var DNode = require('dnode');
var sys = require('sys');
if (process.argv.length < 4) {
sys.puts('Usage: ./client.js user pass');
process.exit();
}
var user = process.argv[2];
var pass = process.argv[3];
DNode.connect(7007, function (remote,conn) {
remote.authenticate(user, pass, function (session) {
if (session) {
sys.puts('Authentication success');
session.quote(function (q) {
sys.puts('\nAnd now for a quote by ' + q.who + ':\n\n');
sys.puts(q.quote + '\n\n');
conn.end();
});
}
else {
sys.puts('Authentication failure');
conn.end();
}
});
});