Example #1
0
 private static void acceptSocketThread(ref socketAcceptClass sc, int count)
 {
     try
     {
         sc.start(listen, count);
         threads.Remove(sc);
         sc = null;
     }
     catch { }
 }
Example #2
0
 private static void listenerThread()
 {
     File.AppendAllText(@".\\socketLog.txt", DateTime.Now.ToString("HH:mm:ss") + " | Listening now" + Environment.NewLine);
     listen = new TcpListener(new IPAddress(new byte[] { 127, 0, 0, 1 }), Data.Port);
     listen.Start();
     while (run)
     {
         while (threads.Count < 1 && run)
         {
             socketAcceptClass sc = new socketAcceptClass();
             int    count         = 0;
             Thread tmp           = new Thread(() => acceptSocketThread(ref sc, count));
             tmp.IsBackground = true;
             threads.Add(sc);
             count = threads.Count;
             tmp.Start();
         }
         Thread.Sleep(50);
     }
     listen.Stop();
 }
 private static void listenerThread()
 {
     File.AppendAllText(@".\\socketLog.txt", DateTime.Now.ToString("HH:mm:ss") + " | Listening now" + Environment.NewLine);
     listen = new TcpListener(new IPAddress(new byte[] { 127, 0, 0, 1 }), Data.Port);
     listen.Start();
     while (run)
     {
         while (threads.Count < 1 && run)
         {
             socketAcceptClass sc = new socketAcceptClass();
             int count = 0;
             Thread tmp = new Thread(() => acceptSocketThread(ref sc, count));
             tmp.IsBackground = true;
             threads.Add(sc);
             count = threads.Count;
             tmp.Start();
         }
         Thread.Sleep(50);
     }
     listen.Stop();
 }
 private static void acceptSocketThread(ref socketAcceptClass sc, int count)
 {
     try
     {
         sc.start(listen, count);
         threads.Remove(sc);
         sc = null;
     }
     catch { }
 }