I have a file into which I store
MQTT server URL
user
password
port number
I read back the file, and then I try to connect
--MQTT
file.open("config.txt", "r")
MQTTs = file.readline()
print("server:"..MQTTs)
MQTTs = "m11.cloudmqtt.com"
MQTTu = file.readline()
MQTTp = file.readline()
MQTTpo = file.readline()
file.close()
print("server:"..MQTTs)
the connection is simple
m = net.createConnection(net.TCP, 0)
print("user:"..MQTTu)
m = mqtt.Client(MQTTu, 120, MQTTu, MQTTp)
-- and a few lines after
m:connect(MQTTs, MQTTpo, 0, function(conn)
print("connected")
m:subscribe("/android/",0, function(conn)
print("subscribed")
end)
end)
The problem that I have is that if the server URL is read from the file... it fails with a DNS error
If I assign its value like in the example above it works.
All other values are properly read from the file
Do you have any idea why URL reading from file doesn't work ?
I have tried to print the values from file and from assignment, they look exactly the same on my terminal view...
Thank you in advance
JP