I have a Photon at a location that can not connect to the cloud. The following is segment from the log:
0000104492 [system] INFO: Cloud: connecting
0000110130 [system] INFO: Resolved host device.spark.io to 54.90.239.114
0000110185 [system] ERROR: connection failed to 54.90.239.114:5683, code=-18
0000110185 [system] WARN: Cloud socket connection failed: -18
0000110240 [system] WARN: Internet available, Cloud not reachable!
0000110240 [system] WARN: Handling cloud error: 3
0000111250 [system] INFO: Cloud: connecting
0000111275 [system] INFO: Resolved host device.spark.io to 54.90.239.114
0000111302 [system] ERROR: connection failed to 54.90.239.114:5683, code=-18
0000111302 [system] WARN: Cloud socket connection failed: -18
0000111302 [system] WARN: Resetting WLAN due to 2 failed connect attempts
0000111508 [system] WARN: Internet available, Cloud not reachable!
0000111508 [system] WARN: Handling cloud error: 3
0000111609 [system] WARN: Resetting WLAN due to SPARK_WLAN_RESET
0000111716 [system] INFO: Network Connect: !SPARK_WLAN_STARTED
0000111716 [system] INFO: ready(): 0; connecting(): 0; listening(): 0; WLAN_SMART_CONFIG_START: 0
What s code -18?
-AP
@superpanda
0000110130 [system] INFO: Resolved host device.spark.io to 54.90.239.114
0000110185 [system] ERROR: connection failed to 54.90.239.114:5683, code=-18
0000110185 [system] WARN: Cloud socket connection failed: -18
It looks like your AP/Router is blocking TCP port 5683 preventing the cloud connection.
I suspected it, but since I was able to open the port with a PC I wanted to verify the meaning of code -18.
Thanks -AP
@superpanda, @bko did a search on the firmware github and suggests that it might be a bad SSID length.
Hmm strange…the length of the SSID is 9 characters. XXXX_XXXX all alpha characters. Also the log indicates I am connected to the AP. I get a DHCP address etc.
I looked on github too and could not find that. Where was it?
@superpanda, @rickkas7 suggested that some socket errors are positive values but returned as negative values to appear as errors. It seems that something is blocking that port.
UPDATE: @rickkas7 indicated that the CONNECTION_RESET is what a firewall blocking the CoAP port would do to block the connection.
@superpanda, the error codes are:
/* 00 */ NO_ERROR,
/* 01 */ PING_TIMEOUT,
/* 02 */ IO_ERROR, // too generic, discontinue using this. Perfer/add a specific one below
/* 03 */ INVALID_STATE,
/* 04 */ INSUFFICIENT_STORAGE,
/* 05 */ MALFORMED_MESSAGE,
/* 06 */ DECRYPTION_ERROR,
/* 07 */ ENCRYPTION_ERROR,
/* 08 */ AUTHENTICATION_ERROR,
/* 09 */ BANDWIDTH_EXCEEDED,
/* 10 */ MESSAGE_TIMEOUT,
/* 11 */ MISSING_MESSAGE_ID,
/* 12 */ MESSAGE_RESET,
/* 13 */ SESSION_RESUMED,
/* 14 */ IO_ERROR_FORWARD_MESSAGE_CHANNEL,
/* 15 */ IO_ERROR_SET_DATA_MAX_EXCEEDED,
/* 16 */ IO_ERROR_PARSING_SERVER_PUBLIC_KEY,
/* 17 */ IO_ERROR_GENERIC_ESTABLISH,
/* 18 */ IO_ERROR_GENERIC_RECEIVE,
/* 19 */ IO_ERROR_GENERIC_SEND,
/* 20 */ IO_ERROR_GENERIC_MBEDTLS_SSL_WRITE,
/* 21 */ IO_ERROR_DISCARD_SESSION,
/* 21 */ IO_ERROR_LIGHTSSL_BLOCKING_SEND,
/* 22 */ IO_ERROR_LIGHTSSL_BLOCKING_RECEIVE,
/* 23 */ IO_ERROR_LIGHTSSL_RECEIVE,
/* 24 */ IO_ERROR_LIGHTSSL_HANDSHAKE_NONCE,
/* 25 */ IO_ERROR_LIGHTSSL_HANDSHAKE_RECV_KEY,
Error 18 is a general receive error which points back to COAP being blocked.
Thanks for the details. Very helpful. -AP
1 Like