當前位置: 首頁>>代碼示例>>C#>>正文


C# Server.Start方法代碼示例

本文整理匯總了C#中Server.Server.Start方法的典型用法代碼示例。如果您正苦於以下問題:C# Server.Start方法的具體用法?C# Server.Start怎麽用?C# Server.Start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Server.Server的用法示例。


在下文中一共展示了Server.Start方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Main

        /// <summary>
        /// The main entry point for the server application.
        /// </summary>
        static void Main()
        {
            Console.Title = "Server is stopped";

            Server server = new Server(443);

            // commands
            Console.WriteLine("Server is stopped.");
            Console.WriteLine("==================");
            Console.WriteLine("Commands:");
            Console.WriteLine("start - Start listening to clients.");
            Console.WriteLine("stop - Stop listening to clients.");
            Console.WriteLine("exit - Close server.");
            Console.WriteLine();

            while (true)
            {
                string command = Console.ReadLine();

                if ("start".Equals(command))
                {
                    server.Start();
                    Console.Title = "Server is running";
                }
                else if ("stop".Equals(command))
                {
                    server.Stop();
                    Console.Title = "Server is stopped";
                }
                else if ("exit".Equals(command))
                    return;
            }
        }
開發者ID:pr3sto,項目名稱:CryptoMessenger,代碼行數:36,代碼來源:Program.cs

示例2: Main

        static void Main(string[] args)
        {
            bool exit = false;

            var obj = new Server();
            obj.Start();

            while (!exit)
            {
                var input = Console.ReadKey();

                switch (input.Key)
                {
                    case ConsoleKey.Escape:
                        exit = true;
                        obj.Close();
                        break;
                    case ConsoleKey.Spacebar:
                        obj.InterdaceUpdate();
                        break;
                    default:
                        break;
                }
            }
        }
開發者ID:Budalica,項目名稱:Online-Auction-House,代碼行數:25,代碼來源:Program.cs

示例3: Main

        static void Main(string[] args)
        {

            IProtocol protocol = new Protocol();
            MultipleThread thread = new MultipleThread(protocol);
            Server server = new Server(thread);
            server.Start();
        }
開發者ID:ITPuppy,項目名稱:myRepo,代碼行數:8,代碼來源:Program.cs

示例4: Main

        public static void Main(string[] args)
        {
            #region Server - separated in later version
            Server.Server _s = new Server.Server();
            _s.Start();
            #endregion

            #region Client - separated in later version
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(true);
            Application.Run(new Gui.Login());
            #endregion
        }
開發者ID:BackupTheBerlios,項目名稱:exnet,代碼行數:13,代碼來源:StartUp.cs

示例5: Main

 static void Main(string[] args)
 {
     try
     {
         Server server = new Server();
         server.Start();
         Console.ReadLine();
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception.ToString());
     }
 }
開發者ID:dawnoble,項目名稱:blackcatproject,代碼行數:13,代碼來源:Program.cs

示例6: Main

 static void Main(string[] args)
 {
     try
     {
         using (Server server = new Server())
         {
             server.Start();
         }
     }
     catch (Exception ex)
     {
         System.Console.WriteLine(ex.Message);
     }
     finally
     {
         System.Console.WriteLine("Произведено завершение работы сервера");
     }
     
 }
開發者ID:MaximilianBlack,項目名稱:tictactoe13,代碼行數:19,代碼來源:Program.cs

示例7: ServerForm

        public ServerForm()
        {
            InitializeComponent();

            Settings.PowerUpFreezeEnabled = false;
            Settings.PowerUpWhiteBricksEnabled = false;
            Settings.PowerUp = 0;
            Settings.PowerUpWhiteBricks = 0;
            Settings.FreezeAllPlayersEnabled = false;

            try
            {
                gameServer = new Server();
                gameServer.Start();

                SetStatus("Online");

                newChallengeToolStripMenuItem.Enabled = true;
            }
            catch (Exception exc)
            {
                MessageBox.Show("Server failed to start: " + exc.Message, "Error");
            }
        }
開發者ID:Hoithebest,項目名稱:legoracersonline,代碼行數:24,代碼來源:ServerForm.cs

示例8: Main

 static void Main(string[] args)
 {
     var server = new Server();
     server.Start();
 }
開發者ID:Trainfire,項目名稱:Drawesome,代碼行數:5,代碼來源:Program.cs

示例9: Main

 public static void Main(string[] args)
 {
     var server = new Server (MainClass.port, MainClass.onlineMode, MainClass.maxPlayers, MainClass.motd, MainClass.difficulty, MainClass.levelName, MainClass.levelType, gamemode, MainClass.ingameMOTD);
     server.Start ();
 }
開發者ID:CServer,項目名稱:CServer,代碼行數:5,代碼來源:Program.cs


注:本文中的Server.Server.Start方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。