jam/test/test-std.js

30 lines
745 B
JavaScript

var proto='http';
//var host='localhost';
var host ='ag-0.de'
if (proto=='http') {
p=port(DIR.IP('http://localhost:*'))
connect(DIR.IP('http://'+host+':10001'))
} else {
p=port(DIR.IP('udp://localhost:*'))
connect(DIR.IP('udp://'+host+':10002'))
}
var counter=0;
function postit(what) {
return function (msg) {
print(what,msg);
counter++; if (counter==4) exit()
}
}
on('link+',function () {
var nodes = connected(DIR.IP('%'));
print(nodes)
if (nodes.length) {
Std.info(nodes[0],'node',postit('std.info node'))
Std.status(nodes[0],'node',postit('std.status node'))
Std.status(nodes[0],'agents',postit('std.status agents'))
Std.status(nodes[0],'links',postit('std.status links'))
}
})
print('Done')