Wiz-IO / platformio-quectel-examples

Examples for PlatformIO Quectel
29 stars 21 forks source link

_htons() in function server() in txMqtt.h of bg96 #9

Open MrXavierB opened 3 years ago

MrXavierB commented 3 years ago

Hi,

I think I may have found a problem in /arduino/libraries/bg96/Ethernet/src/txMqtt.h at line 85.

The actual code is: sin4->sin_port = _htons(port);

I am not exactly sure why _htons is used here. I tried the publish_subscribe example and was not able to connect to the eclipse mosquito server. When I print the value of sin4->sin_port after the call of server() I have a strange value in it. I saw that both variables were already uint16_t types so I tried to simply write:

sin4->sin_port = port;

I retried with this line and was able to connect to the eclipse mosquito server. Is this a bug or am I missing something?

Thank you!