*
*/
public class ExampleSender {
public static void main(String[] args) {
Graph g = new MultiGraph("G");
// - the sender
NetStreamSender nsc = null;
try {
nsc = new NetStreamSender(2001);
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
nsc.setPacker(new Base64Packer());
// - plug the graph to the sender so that graph events can be
// sent automatically
g.addSink(nsc);
// - generate some events on the client side
String style = "node{fill-mode:plain;fill-color:#567;size:6px;}";
g.addAttribute("stylesheet", style);
g.addAttribute("ui.antialias", true);
g.addAttribute("layout.stabilization-limit", 0);
for (int i = 0; i < 500; i++) {
g.addNode(i + "");
if (i > 0) {
g.addEdge(i + "-" + (i - 1), i + "", (i - 1) + "");
g.addEdge(i + "--" + (i / 2), i + "", (i / 2) + "");
}
}
}