added condition on socket listeners to check if this device is the slave