diff --git a/src/server/server.java b/src/server/server.java index 3d92233..cbab7e3 100644 --- a/src/server/server.java +++ b/src/server/server.java @@ -89,7 +89,8 @@ public String getDevicesFromEmail(String email) { // Sends the desired temperature on port sendDesiredTempPORT public void sendDesiredTemp(String desiredTemperature, String thermostatIP) throws Exception { // Opens a sending port - Socket sender = new Socket(thermostatIP, 7002); + // Replace this with the thermostatIP string if we get multicast working + Socket sender = new Socket("192.168.1.3", 7002); try { while (true) { // Instantiate a printwriter so we can write to the output stream diff --git a/src/thermostat/ThermostatDevice.java b/src/thermostat/ThermostatDevice.java index f3417bb..94d2324 100644 --- a/src/thermostat/ThermostatDevice.java +++ b/src/thermostat/ThermostatDevice.java @@ -24,6 +24,7 @@ public class ThermostatDevice extends ThermostatNetworking implements Deviceable private Timer clock; private String serialNumber; String desiredTempString; + String serverIP; // Threaded listener thread Thread thermostatListener; @@ -58,7 +59,7 @@ public void sensorUpdateEvent(Sensorable sensor) { private void updateServer(DataObject dataReading){ //this.sendIP("192.168.1.2"); try { - this.sendCurrentTemp(dataReading.getValue()); + this.sendCurrentTemp(dataReading.getValue(), serverIP); } catch(Exception e){ System.out.println("Error sending to server"); } @@ -91,10 +92,11 @@ public void sendIP(String ipAddress) { */ // CONVERT THIS TO INT - public void sendCurrentTemp(String currentTemp) throws IOException { + public void sendCurrentTemp(String currentTemp, String serverIP) throws IOException { // Sends the current temperature on port sendCurrentTempPORT // Open a sending port - Socket sender = new Socket("192.168.1.3", 7000); + // Replace this with the serverIP string if we get multicast working + Socket sender = new Socket("192.168.1.2", 7000); try { while (true) { // Instantiate a printwriter so we can write to the output stream