public void REcivedData() { try { Console.WriteLine("Car heartbeat is working"); ManageLocation manageLocation = new ManageLocation(); while (IsWorking) { String LastLocation = "I am a live"; manageLocation.send_Data(ServerIPheartbeat, 9004, LastLocation); Thread.Sleep(2000); } Console.WriteLine("Car heartbeat is Stopped"); } catch (Exception ex2) { //MessageBox.Show(ex2.Message); } }
//reading car location static public void REcivedData() { try { ManageLocation manageLocation = new ManageLocation(); Console.WriteLine("Car App is working"); while (IsWorking) { Random rnd = new Random(); double log = rnd.Next(2232, 345344533); // creates a number between 2232 and 345344533 double lat = rnd.Next(2232, 345344343); // creates a number between 2232 and 345344533 String LastLocation = "Car Location:log:" + log + ",lat:" + lat; manageLocation.send_Data(ServerIP, ServerPort, LastLocation); Thread.Sleep(1000); } Console.WriteLine("Car App is Stopped"); } catch (Exception ex2) { //MessageBox.Show(ex2.Message); } }