hello.. I'm using the 2.0.8.0 version..
It has been impossible to connect to a Mosquitto server, event in a local host.
I always have a timeout.
I tested the server with MQTTX (client) and openHab, and all ok.
I also had tested the TMS demo that suggests a connection with Mosquitto webserver for tests, and also i have the same problem...
If I use MQTTX to connect from the same machine to the Mosquitto test server, all ok..
I also tested the TMS demo client in another machine, and the problem continues..
when connection I get the follow messages in log:
CLIENT- Connecting ---------------------------
Keep Alive thread - Started
Comm thread - Started
Initializing Indy TCP Client
Connecting Indy TCP Client
Socket allocated ...
..
I also checked firewall, and any other things I could do...
Is this connection using SSL and if so, did you setup the SSLIOHandler / SSL port?
Hello.
I'm not using SSL, the server port is 1883..
I've attached the image from MQTTX that connects fine..
ant this is part of properties... as I tried to change many settings and nothing works..
the state always is connecting and I get timeout
the same occurs if I use the test server:
test.mosquitto.org on port 1883... always trying to connect... but the socket is stablished
Hello, I'm still without find a solution. May you help?
I retested this here with a default TMSMQTTClient component on the form and the code:
uses
System.NetEncoding;
procedure TForm1.Button1Click(Sender: TObject);
begin
TMSMQTTClient1.UseSSL := false;
TMSMQTTClient1.BrokerPort := 1883;
TMSMQTTClient1.BrokerHostName := 'test.mosquitto.org';
TMSMQTTClient1.Connection.ReadTimeOut := 2000;
TMSMQTTClient1.Connect();
end;
procedure TForm1.TMSMQTTClient1ConnectedStatusChanged(ASender: TObject;
const AConnected: Boolean; AStatus: TTMSMQTTConnectionStatus);
begin
if aconnected then
begin
TMSMQTTClient1.Subscribe('tmstest');
memo1.Lines.Add('connected');
TMSMQTTClient1.Publish('tmstest','test payload');
end
else
memo1.Lines.Add('disconnected');
end;
procedure TForm1.TMSMQTTClient1PublishReceived(ASender: TObject;
APacketID: Word; ATopic: string; APayload: TBytes);
begin
memo1.Lines.Add(ATopic +' -> '+TEncoding.ANSI.GetString( APayload ));
end;
and I could not see an issue. If you have further read-time exceptions, try to set to ignore these from the IDE (these are triggered from the underlying Indy library that is used). There are many related topics on Indy for this, one of these is:
https://stackoverflow.com/questions/61885735/getting-a-lot-of-read-timed-out-exceptions-from-indys-idtcpserver
Hi Bruno.
The problem was continuing with your example.. I've uninstalled the components and reinstalled. After that works fine..
I don't know if there was an new version or problem in packages..
Maybe there was still an old version on your system, but good to hear this issue is resolved now!