eclipse / paho.mqtt-sn.embedded-c

Paho C MQTT-SN gateway and libraries for embedded systems. Paho is an Eclipse IoT project.
https://eclipse.org/paho
Other
315 stars 178 forks source link

Connect failed from RIOT virtual machine #152

Closed jhx2002 closed 5 years ago

jhx2002 commented 5 years ago

setup:

image

jhx2002 commented 5 years ago

Test a case, running gateway with ipv6. got error:


20190529 181941.706 MQTT-SN/gateway1 has been started.

 ConfigFile: ./gateway.conf
 ClientList: ./clients.conf
 PreDefFile: ./predefinedTopic.conf
 SensorN/W:  UDP Multicast 225.1.1.1:1883 Gateway Port 10000
 Broker:     ::C0A8:0078 : 1883, 8883
 RootCApath: (null)
 RootCAfile: (null)
 CertKey:    (null)
 PrivateKey: (null)

20190529 181943.000   error:getaddrinfo(): Address family for hostname not supported
Error: BrokerSendTask: MQTT-SN/gateway1QoS-1 can't connect to the broker. errno=0 Success 
ty4tw commented 5 years ago

Hi jhx2002 ,

SensorN/W is not IPV6.

SensorN/W: UDP Multicast 225.1.1.1:1883 Gateway Port 10000

When you set MulticastIP= of gateway.conf to a IPV6 address, it is shown like
SensorN/W: Gateway Port: 10000 Broadcast Address: XXXX:XX:-------:XXX::X Interface: wpan0

build the gateway for UDP6 with command 'make SENSORNET=udp6'.
and change the gateway.conf. then rerun the GW. I don't know anything about RIOT. but UDP6 is working on the GW.
I hope you can make it.

jhx2002 commented 5 years ago

I rewrite gateway.conf follow your suggestion , but still can't connect. Than you @ty4tw

# SensorNetwork UDP6 config
#GatewayUDP6Bind=fe80::67b8:da5c:8d37:801
GatewayUDP6Bind=fec0:affe::1 
GatewayUDP6Port=10000
GatewayUDP6Broadcast=FF02::1
GatewayUDP6If=tapbr0
ty4tw commented 5 years ago

It might be a RIOT problem. What happen if you run the GW on the host, not on the virtual machine?

jhx2002 commented 5 years ago

I could connect Gateway with other tools running on linux. Thank you!