void Cleanup() { if (node != null) { node.Dispose (); node = null; } }
public void Listen(int port) { var node = new TcpNode (port); node.Listen (port); Node.Connect ("localhost:" + port); // nodes.Add (node); }
public override int Run(string[] remainingArguments) { if(remainingArguments[0] == "stop"){ if(node != null){ Console.WriteLine("stopping " + node.Id); Cleanup(); } return 0; } Cleanup (); var name = remainingArguments[0]; var port = remainingArguments[1].Convert<int>(); node = new TcpNode(port, name); node.Listen(port, isLocalOnly: false); node.AddBuiltins(); Console.WriteLine("node " + node.Id + " listening on " + port); return 0; }
void CreateNode() { if(node != null) return; node = new TcpNode(12453,"dht"); }
public static TcpNode Open(int defaultPort = 0, string name = null) { var n = new TcpNode(defaultPort, name); n.Listen(defaultPort); return n; }