Skip to content

cannot connect to a xamarin server #331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
javirs85 opened this issue Feb 20, 2019 · 1 comment
Open

cannot connect to a xamarin server #331

javirs85 opened this issue Feb 20, 2019 · 1 comment

Comments

@javirs85
Copy link

I first tested opening a MQTT Broker APP in my phone and both simple and robust clients to connected to it flawlessly. Then I opened a Xamarin.Forms server using System.Net.Mqtt.Server and tried to connect and I get this :

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "Utils.py", line 10, in __init__
File "Utils.py", line 16, in ConnectMQTT
File "umqtt/simple.py", line 99, in connect
MQTTException: 2

I checked where this error is coming from and it looks like is from here:

    self.sock.write(premsg, i + 2)
    self.sock.write(msg)
    #print(hex(len(msg)), hexlify(msg, ":"))
    self._send_str(self.client_id)
    if self.lw_topic:
        self._send_str(self.lw_topic)
        self._send_str(self.lw_msg)
    if self.user is not None:
        self._send_str(self.user)
        self._send_str(self.pswd)
    resp = self.sock.read(4)
    assert resp[0] == 0x20 and resp[1] == 0x02
    if resp[3] != 0:
        raise MQTTException(resp[3])   <------- Here!
    return resp[2] & 1

But I cannot figure out what's wrong ... I guess is some configuration in the server or in the client that is not matching (like mqtt version, or auth method (I used no auth so far, to make sure everything is simple)

Can you help ?

@ric96
Copy link

ric96 commented Oct 10, 2021

same here, i am even using keepalive=60 because my broker is 2.0.12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants