def send_data(self): try: self.data = self.sensor_data() sdr.send(self.data, PORT1) except: print("Server not available...Trying another port") self.data = self.sensor_data() sdr.send(self.data, PORT2)
def send_data(self): try: self.data = self.sensor_data() # send data sdr.send(self.data, PORT1) except: print("Server not available") self.data = self.sensor_data() # send data sdr.send(self.data, PORT2)
def send_data(self): try: self.data = self.sensor_data() # send data snd.send(self.data, PORT1) #power_discharge(); except: print("Server not available.....Trying another") self.data = self.sensor_data() snd.send(self.data, PORT2)
def send_data(self): try: self.data = self.sensor_data() # send data sdr.send(self.data, PORT) self.power = self.battery.decrease_trans_energy(sys.getsizeof(self.data)) print("size: ", sys.getsizeof(self.data)) print("energy level: ", self.power) except: print("Server not available") self.data = self.sensor_data() # send data sdr.send(self.data, PORT_SINK_2) self.power = self.battery.decrease_trans_energy(sys.getsizeof(self.data)) print("size: ", sys.getsizeof(self.data)) print("energy level: ", self.power)