简体   繁体   English

仅在Mac上连接时MQTT Eclipse Paho Java客户端超时

[英]MQTT Eclipse Paho Java Client timeout while connecting only on Mac

I am using Eclipse Paho Java MQTT client to connect to Mosquitto Broker, Jar used is mqttv3.jar. 我正在使用Eclipse Paho Java MQTT客户端连接到Mosquitto Broker,使用的Jar是mqttv3.jar。 While connecting to MQTT broker I have to pass a username and password as connection option for authentication. 连接到MQTT代理时,我必须传递用户名和密码作为身份验证的连接选项。 I am setting the same in MqttConnectOptions object and passing that object to client.connect() function. 我在MqttConnectOptions对象中设置了相同的对象,并将该对象传递给client.connect()函数。 It's standard procedure. 这是标准程序。 When authentication credential are correct it connects to the broker with no problem. 身份验证凭据正确时,它将毫无问题地连接到代理。

A weird behaviour happens when first login credentials are incorrect and broker refuses to connect as expected. 当第一个登录凭据不正确并且代理拒绝按预期的连接时,就会发生怪异的行为。 But immediately after the connection attempt is made with CORRECT credentials I am receiving following MqttException. 但是,使用正确的凭据进行连接尝试后,我立即收到以下MqttException。

Time out waiting for response from server (32000) 等待服务器的响应超时(32000)

I have used this same Java code in OS X 10.8.2 and Windows 7 but surprisingly, this problem appears only on Mac and works perfectly on Windows. 我在OS X 10.8.2和Windows 7中使用了相同的Java代码,但令人惊讶的是,此问题仅在Mac上出现,并且在Windows上可以正常使用。

Is this kind of bug as it works on one OS and not on other? 这种错误是在一个操作系统上起作用,而不是在其他操作系统上起作用吗?

There is no issue with the Mosquitto broker as it works perfectly with command line client with this same scenario. Mosquitto代理没有问题,因为在这种情况下,它可以与命令行客户端完美配合。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM