public static void Main(string[] args) { ReceiveQueue.Start(PacketHandler.Handle); ServerSocket.Start(13338); Console.WriteLine($"Server running!"); var t = new Thread(() => { Console.WriteLine($"Heartbeat Thread started."); while (true) { foreach (var kvp in Collections.Players) { var player = kvp.Value; if (DateTime.Now >= player.LastPing.AddSeconds(1)) { Console.WriteLine($"Sending Ping to {player.Name}/{player.Username}."); player.Socket.Send(MsgPing.Create(player.UniqueId)); player.LastPing = DateTime.Now; } } Thread.Sleep(1); } }); t.Start(); while (true) { Console.ReadLine(); } }
static void Main() { #region Seeding SeederHandler.Seed(new SeederEntriesAmount { userSeederAmount = 2, channelSeederAmount = 1, messageSeederAmount = 50, }); #endregion #region Socket // Start UDP Broadcast Receiver that answers Clients search for the server's local IP broadcastReceiver.StartReceive(); // Start TCP Server serverSocket.Start(); Logger.Information("Listening to new connections..."); while (true) { string cmd = Console.ReadLine(); if (cmd == "clear") { Console.Clear(); } else if (cmd == "q") { break; } } #endregion }
public static void Main() { FConsole.Title = "SERVER APP"; GlobalExceptionHandler.Setup(); Jit.PreJit(); Core.Db = new JsonDb(); Core.Db.EnsureDbReady(); ReceiveQueue.OnPacket += PacketRouter.Route; ServerSocket.Start(Core.Settings.Port); FConsole.WriteLine("Online"); while (true) { var cmd = FConsole.ReadLine(); switch (cmd) { case "exit": Core.Db.Save(); Environment.Exit(0); break; default: break; } } }
private Protocol(int port) { _builds = new Dictionary <int, CodeBuild>(); _socket = new ServerSocket(port); _socket.Closed += this.OnClosed; _socket.Accepted += this.OnAccepted; _socket.Error += this.OnError; _socket.Receive += this.OnReceive; _socket.Start(); }
public void Start() { ServerSocket.Start(); DisplayColoredText("Сервер запущен!", ConsoleColor.White); while (true) { TcpClient client = ServerSocket.AcceptTcpClient(); GetAndParseUserData(client); //начинаем читать пользователя чтобы узнать что он хочет, авторизоватся или зарегистрироватся } }
public static bool Start(Form owner) { string result = server.Start(owner); if (result != null) { MessageBox.Show(result); return(false); } return(true); }
static void Main() { GlobalExceptionHandler.Setup(); FConsole.WriteLine("Hello World!"); ServerSocket.OnPacket += PacketRouter.Handle; ServerSocket.Start(65533); while (true) { Console.ReadLine(); } }
private void Form1_Load(object sender, EventArgs e) { // Hide(); // ShowIcon = false; // ShowInTaskbar = false; // FormBorderStyle = FormBorderStyle.None; StopWatch.Start(); Console.Title = "TheArcaneChat Server -=- v1.0.0"; Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.White; Console.Clear(); ServerSocket.Start(); Log(" >> Server Started"); //Visible = false; new Thread(() => { //serverSocket.Server.Listen(1000); while (true) { try { while (!ServerSocket.Pending()) { Thread.Sleep(5); } ClientSocket = ServerSocket.AcceptTcpClient(); //Log($" >> Client No: {_counter++} started!"); Clients.Add(ClientSocket); new HandleClient(this).StartClient(ClientSocket, _counter); _counter++; new Task(() => { new SoundPlayer(@"C:\Windows\Media\Speech On.wav").Play(); }).Start(); this.Invoke(new MethodInvoker(() => { ConnectionCount.Text = $"Connected clients: {Clients.Count}"; })); } catch (Exception exception) { //Log(exception); } } }).Start(); }
static void Main(string[] args) { ClientFacade clientFacade = new ClientFacade(); ServerFacade serverFacade = new ServerFacade(clientFacade); IServerController serverController = new ServerController(serverFacade); IServer server = new ServerSocket(serverController); serverFacade.Init(serverController); clientFacade.Init(serverController); Task.Run(() => server.Start()); while (Console.ReadLine().ToLower() != "stop") { ; } }
public static void Main(string[] args) { if (args.Length > 0) { BotCount = int.Parse(args[0]); } ReceiveQueue.Start(PacketHandler.Handle); ServerSocket.Start(13338); Console.WriteLine("Server running!"); World.Systems.Add(new GCMonitor(true, false)); World.Systems.Add(new MoveSystem(true, false)); for (int i = 0; i < BotCount; i++) { ref var npc = ref World.CreateEntity(100_000 + i); npc.Add(new NetworkComponent(100_000 + i)); npc.Add <PositionComponent>(); npc.Add <DestinationComponent>(); npc.Add(new SpeedComponent(16)); npc.Add <VelocityComponent>(); Collections.Npcs.TryAdd(100_000 + i, new Npc(100_000 + i)); }