I have TMS MQTT Component on my FMX form which sends MQTT messages I randomly keep on getting Socket Error #10054 But I can't figure out what is causing this.
Below is the MadExcept error.

exception message : Socket Error # 10054 Connection reset by peer.

thread $2da0 (TTMSMQTTWriterThread):
IdStack 976 +54 TIdStack.RaiseSocketError
IdStack 899 +1 TIdStack.RaiseLastSocketError
IdStack 873 +2 TIdStack.CheckForSocketError
IdStackWindows 1075 +1 TIdStackWindows.WSSend
IdStackBSDBase 454 +3 TIdStackBSDBase.Send
IdSocketHandle 335 +1 TIdSocketHandle.Send
IdIOHandlerStack 431 +2 TIdIOHandlerStack.WriteDataToTarget
IdIOHandler 2639 +20 TIdIOHandler.WriteDirect
IdIOHandler 2497 +4 TIdIOHandler.Write
TMS.MQTT.Connection 407 +8 TTMSMQTTNetworkConnection.Write
TMS.MQTT.Client.Threading 482 +5 TTMSMQTTWriterThread.HandlePacketQos0
TMS.MQTT.Client.Threading 511 +18 TTMSMQTTWriterThread.Work
TMS.MQTT.Client.Threading 632 +7 TTMSMQTTWorkerThread.Execute
madExcept HookedTThreadExecute
madExcept HookedTThreadExecute
System.Classes 15711 +18 ThreadProc
System.Classes 15740 +47 ThreadProc
System 25395 +45 ThreadWrapper
madExcept CallThreadProcSafe
madExcept ThreadExceptFrame
madExcept ThreadExceptFrame
75b2fa27 +17 KERNEL32.DLL BaseThreadInitThunk
created by main thread ($2d44) at:
System.Classes 15769 +1 TThread.Create

Please help since I keep getting this unexpectedly.
I Believe TMS should deal with this exception internaly.


Is this when running the app outside the IDE in release mode?


@brunofierens My mistake. I am running it in DebugMode which is when MadExcept gets fired. Any advice on this?

In Debug Mode, the IDE catches all exceptions, regardless of these exceptions already been handled in the code.
You should not see these exceptions when running the app outside the IDE or when compiling in release mode. This is how Delphi treats exception handling in debug mode. Or under Debugger Options, Language Exceptions, you could turn off these will be caught by the IDE in debug mode.

I run it outside the IDE but compiled it in Debug Mode.
I don't think every time the network gets restarted we should have this exception being raised.

If you do not want to see this exception, you'll have to configure madExcept to ignore this exception. Afaik, madExcept catches all exceptions by default.