static void Main(string[] args) { //db = new LightChainDB(); //Console.WriteLine("lightchain " + db.Version); //db.Init("./testdb"); server = new lightchain.httpserver.httpserver(); server.SetWebsocketAction("/ws", (socket) => new websockerPeer(socket)); server.SetFailAction(OnHttp404); server.Start(80);//一个参数,只开80端口 Console.WriteLine("http on port 80"); InitMenu(); MenuLoop(); }
static void Main(string[] args) { //把当前目录搞对,怎么启动都能找到dll了 var lastpath = System.IO.Path.GetDirectoryName(typeof(Program).Assembly.Location);; Console.WriteLine("exepath=" + lastpath); Environment.CurrentDirectory = lastpath; config = Config.Parse(System.IO.File.ReadAllText("config.json")); storage = new StorageService(); storage.Init(); httpserver = new lightchain.httpserver.httpserver(); httpserver.SetWebsocketAction("/ws", (socket) => new websockerPeer(socket)); httpserver.SetFailAction(OnHttp404); httpserver.Start(config.server_port);//一个参数,只开80端口 Console.WriteLine("http on port " + config.server_port); InitMenu(); MenuLoop(); }