Meaning of error codes of MQTT TCP connect error

I am trying to troubleshoot a MQTT connection that breaks every once in a while. It only goes back once the device is rebooted. The device logs looks like the following:

esp32_ABE600 9848 94448.854 2 2|mgos_mqtt_conn.c:214    MQTT0 Disconnect
esp32_ABE600 9849 94448.861 2 2|mgos_mqtt_conn.c:519    MQTT0 connecting after 1916 ms
esp32_ABE600 9850 94450.785 2 2|mgos_mqtt_conn.c:435    MQTT0 connecting to 192.168.1.12:1883
esp32_ABE600 9851 94450.798 2 2|mgos_mqtt_conn.c:188    MQTT0 TCP connect error (-14)
esp32_ABE600 9852 94450.804 2 2|mgos_mqtt_conn.c:214    MQTT0 Disconnect
esp32_ABE600 9853 94450.811 2 2|mgos_mqtt_conn.c:519    MQTT0 connecting after 4158 ms
esp32_ABE600 9854 94454.978 2 2|mgos_mqtt_conn.c:435    MQTT0 connecting to 192.168.1.12:1883
esp32_ABE600 9855 94454.991 2 2|mgos_mqtt_conn.c:188    MQTT0 TCP connect error (-14)
esp32_ABE600 9856 94454.998 2 2|mgos_mqtt_conn.c:214    MQTT0 Disconnect
esp32_ABE600 9857 94455.004 2 2|mgos_mqtt_conn.c:519    MQTT0 connecting after 7751 ms
esp32_ABE600 9859 94462.764 2 2|mgos_mqtt_conn.c:435    MQTT0 connecting to 192.168.1.12:1883
esp32_ABE600 9860 94462.778 2 2|mgos_mqtt_conn.c:188    MQTT0 TCP connect error (-14)
esp32_ABE600 9861 94462.784 2 2|mgos_mqtt_conn.c:214    MQTT0 Disconnect
esp32_ABE600 9862 94462.791 2 2|mgos_mqtt_conn.c:519    MQTT0 connecting after 14504 ms
esp32_ABE600 9864 94477.303 2 2|mgos_mqtt_conn.c:435    MQTT0 connecting to 192.168.1.12:1883
esp32_ABE600 9865 94477.317 2 2|mgos_mqtt_conn.c:188    MQTT0 TCP connect error (-14)
esp32_ABE600 9866 94477.323 2 2|mgos_mqtt_conn.c:214    MQTT0 Disconnect
esp32_ABE600 9867 94477.330 2 2|mgos_mqtt_conn.c:519    MQTT0 connecting after 35033 ms
esp32_ABE600 9872 94512.371 2 2|mgos_mqtt_conn.c:435    MQTT0 connecting to 192.168.1.12:1883
esp32_ABE600 9875 94531.629 2 2|mgos_mqtt_conn.c:188    MQTT0 TCP connect error (-13)
esp32_ABE600 9876 94531.635 2 2|mgos_mqtt_conn.c:214    MQTT0 Disconnect
esp32_ABE600 9877 94531.642 2 2|mgos_mqtt_conn.c:519    MQTT0 connecting after 57873 ms

So I get a TCP connect error with error code -14 four times and then error code -13 after which it stops at “connecting”. What I’m wondering is what the error codes (-14 and -13) actually mean. I have been trying to search online but have not found an explanation. Could anyone point me in the right direction?

Sometimes the easier way is to use a network sniffer like Wireshark and see what is going on.
Others you can get away with raising log level up to verbose (4), or observing the broker logs if you control it, which judging by the address seems to be the case