public static void Run() { Task.Run(() => { var myServer = new ServerAsync("127.0.0.1", 8080); myServer.Start(); }); }
static void Main(string[] args) { ServerBasic s = new ServerAsync(); s.Server(); Console.ReadKey(); }
private void StartServer(object sender, RoutedEventArgs e) { cancelTokenSource = new CancellationTokenSource(); token = cancelTokenSource.Token; Action <string> AddMessageAction = AddMessage; Action <string> PrintIp = EditPortBox; int port = Int32.Parse(PortBox.Text); server = new ServerAsync(port, AddMessageAction, token); server.StartServer(); IpBox.Text = server.IP.ToString(); }
static void Main(string[] args) { Connection.Log.Init(Console.WriteLine); LockStep_lib.Log.Init(Console.WriteLine); Core.Init(); BattleManager.Instance = new BattleManager(); ServerAsync<PlayerUnit> server = new ServerAsync<PlayerUnit>(); //ServerUdp<PlayerUnit> server = new ServerUdp<PlayerUnit>(); if (args.Length == 2) { int minLagTime = int.Parse(args[0]); int maxLagTime = int.Parse(args[1]); server.OpenLagTest(minLagTime, maxLagTime); } //server.OpenLagTest(100, 100); server.Start("0.0.0.0", 1999, 100, 12000); //server.Start("0,0,0,0", 1999, 12000); Stopwatch watch = new Stopwatch(); watch.Start(); while (true) { long t0 = watch.ElapsedMilliseconds; BattleManager.Instance.Process(BattleManager.Instance.Update); long t1 = watch.ElapsedMilliseconds; int deltaTime = (int)(t1 - t0); int time = Constant.TICK_TIME - deltaTime; if (time > 0) { Thread.Sleep(time); } } }
static void Main(string[] args) { if (args.Length == 0) { Console.WriteLine("Please run with an argument: server, serverasync, serverasyncoldsyntax, serverasyncoldsyntaxmanualreset, serverasyncnonblocking, client, clientasync"); } else if (args[0] == "server") { Server.Run(); } else if (args[0] == "serverasync") { ServerAsync.Run(); } else if (args[0] == "serverasyncoldsyntax") { ServerAsyncOldSyntax.Run(); } else if (args[0] == "serverasyncoldsyntaxmanualreset") { ServerAsyncOldSyntax.Run(); } else if (args[0] == "serverasyncnonblocking") { ServerAsyncNonblocking.Run(); } else if (args[0] == "client") { Client.Run(); } else if (args[0] == "clientasync") { ClientAsync.Run(); } else { Console.WriteLine("Please run with an argument: server, serverasync, serverasyncoldsyntax, serverasyncoldsyntaxmanualreset, serverasyncnonblocking, client, clientasync"); } Console.ReadLine(); }
static void Main(string[] args) { ServerAsync server = new ServerAsync(); server.Start(); }