Exemplo n.º 1
0
 public static void StartServer()
 {
     if (isOn)
     {
         try {
             EndServer();
         } catch (Exception ex) {
             Debug.Log(ex.ToString());
         }
     }
     else
     {
         isOn = true;
     }
     listener.StartServer();
 }
Exemplo n.º 2
0
 public static void ToggleServer(bool runServer = true)
 {
     if (runServer) //Start server
     {
         if (isRunning)
         {
             try
             {
                 if (isRunning)
                 {
                     listener.EndServer();
                     isRunning = false;
                 }
             }
             catch (Exception ex)
             {
                 Debug.Log(ex.ToString());
             }
         }
         isRunning = true;
         listener.StartServer();
     }
     else //Stop server
     {
         try
         {
             if (isRunning)
             {
                 listener.EndServer();
                 isRunning = false;
             }
         }
         catch (Exception ex)
         {
             Debug.Log(ex.ToString());
         }
     }
 }