static void Main(string[] args) { //BaseServer<TransModel, BaseToken> server = new BaseServer<TransModel, BaseToken>(12345); BaseServer <TransModel, H5Token> server = new BaseServer <TransModel, H5Token>(12345); AbsCoding.Ins = new PbCoding(); server.Init(MessageHandler.Ins); server.Start(); DbHelperMySQL.connectionString = AppSetting.Ins.Settings["connstring"]; //CidModel m = new CidModel(1, 11, 111, -500); //byte[] ms = SeProtobuf.Serialization(m); //CidModel m2 = SeProtobuf.DeSerialization<CidModel>(ms); //Console.WriteLine(m2.cid); //Console.WriteLine(AppSetting.GetValue("test")); //log.Trace("f**k you"); //DbHelperMySQL.connectionString = "server=120.25.84.142;database=TaskServer;uid=yellow;pwd=qW789456123="; //DataResult dr = DbHelperMySQL.Query("select * from user"); //Console.WriteLine(dr.rows); while (true) { Console.ReadLine(); } }
static void Main() { BaseServer server = new BaseServer();//Create an instance of the server //Prepare to Listen for connections on port 6789 arriving on all addresses belogning to this machine, //If there is a connection accept it and create a new instance of ConnectedClient to pass it to. server.Init(new IPEndPoint(IPAddress.Any, 6789), typeof(ConnectingClient)); server.StartListening();//Begin listening for connections while (true) { Thread.Sleep(5); //Keep ticking over } }
static void Main(string[] args) { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); Console.OutputEncoding = System.Text.Encoding.UTF8; //StreamWriter sw = new StreamWriter("ConsoleOutput.txt"); //Console.SetOut(sw); //BaseServer<TransModel, H5Token> server = new BaseServer<TransModel, H5Token>(12345); //AbsCoding.Ins = new PbCoding(); //server.Init(IMessageHandler.Ins); //server.Start(); //DbHelperMySQL.connectionString = AppSetting.Ins.Settings["connstring"]; //CidModel m = new CidModel(1, 11, 111, -500); //byte[] ms = SeProtobuf.Serialization(m); //CidModel m2 = SeProtobuf.DeSerialization<CidModel>(ms); //Console.WriteLine(m2.cid); //Console.WriteLine(AppSetting.GetValue("test")); //DbHelperMySQL.connectionString = "server=120.25.84.142;database=TaskServer;uid=yellow;pwd=qW789456123="; //DataResult dr = DbHelperMySQL.Query("select * from user"); //Console.WriteLine(dr.rows); #if true //Test t = new Test(); if (AppSetting.Ins.GetInt("Mode") == 1) { HttpHandler handler2 = new HttpHandler(new ASpotHandle(), AppSetting.Ins.GetValue("HttpUtlA")); } else { HttpHandler handler = new HttpHandler(new SpotHandle(), AppSetting.Ins.GetValue("HttpUtl")); } while (true) { Task.Run(delegate { Thread.Sleep(36000000); }).Wait(); } #else int port = AppSetting.Ins.GetInt("Port"); BaseServer <TransModel, BaseToken> server = new BaseServer <TransModel, BaseToken>(port); server.Init(NetCenter.Ins); server.Start(); AbsCoding.Ins = new PbCoding(); //TaticsManager.GetIns(); Test t = new Test(); while (true) { Task.Run(delegate { Thread.Sleep(36000000); }).Wait(); } #endif //sw.Flush(); //sw.Close(); }