private void btn_startServer_Click(object sender, EventArgs e)
        {
            server = new ServerSocket(this, localIp);
            server.isRunning = true;
            oThread = new Thread(new ThreadStart(server.StartListening));

            oThread.Start();

            //Wait for the thread to start up
            while (!oThread.IsAlive) ;

            //Sleep the main thread so the server has a moment to process
            Thread.Sleep(1);
        }
 private void btn_stopServer_Click(object sender, EventArgs e)
 {
     try
     {
         server.isRunning = false;
         oThread.Abort();
         lbl_serverStatus.Text = "Server Status: Off";
         lbl_clientStatus.Text = "Client Connected: False";
         lbl_pos.Text = "Mouse Pos: ";
         server = null;
         oThread = null;
     }
     catch (Exception ex)
     {
         //Gotta catch em all
         MessageBox.Show("Error stopping server: " + ex.ToString());
     }
 }