本文整理汇总了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;
}
}
示例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;
}
}
}
示例3: Main
static void Main(string[] args)
{
IProtocol protocol = new Protocol();
MultipleThread thread = new MultipleThread(protocol);
Server server = new Server(thread);
server.Start();
}
示例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
}
示例5: Main
static void Main(string[] args)
{
try
{
Server server = new Server();
server.Start();
Console.ReadLine();
}
catch (Exception exception)
{
Console.WriteLine(exception.ToString());
}
}
示例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("Произведено завершение работы сервера");
}
}
示例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");
}
}
示例8: Main
static void Main(string[] args)
{
var server = new Server();
server.Start();
}
示例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 ();
}