Hello,
I am trying to connect a Lego Robot as a subscriber to my local broker on my notebook. The client and the broker are in the same network.
I can connect to the online HiveMQ broker successfully. When I am trying to connect to my notebook it never works. I think I am doing something wrong in giving the IP adress of the notebook.
import com.hivemq.client.mqtt.mqtt5.Mqtt5BlockingClient;
import com.hivemq.client.mqtt.mqtt5.Mqtt5Client;
import java.io.IOException;
import java.net.InetAddress;
public class SubOnly{
static Mqtt5BlockingClient client;
static Mqtt5BlockingClient clientError;
public static void main(String... args) throws IOException {
client =
Mqtt5Client.builder()
.identifier("Subscriber")
.serverHost(InetAddress.getByName("192.168.0.9"))
.serverPort(1883)
.buildBlocking();
client.connect();
System.out.println("SubscribedBroker");
System.out.println(InetAddress.getLocalHost().getHostAddress());
}}