当前位置: 首页>>代码示例>>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;未经允许,请勿转载。