-
Notifications
You must be signed in to change notification settings - Fork 8
/
Program.cs
42 lines (37 loc) · 1.03 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using Blank_TCP_Server.Language;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
namespace Blank_TCP_Server
{
static class Program
{
static Mutex mutex = new Mutex(true, "TCPSERVER DingJianchen-2017-7-18");
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (!mutex.WaitOne(TimeSpan.FromSeconds(3), false))
{
Console.WriteLine("Another instance of the app is running. Bye!");
Thread.Sleep(2000);
return;
}
try
{
Console.WriteLine("Application is Running!");
}
finally
{
mutex.ReleaseMutex();
}
Application.Run(new tcpform());
}
}
}