Udp error codes listed anywhere?


OK so I have a Photon app (its no longer a simple one), which used to be able to send UDP packets, but now returns -26 to sendPacket.

Are these codes actually defined somewhere please ???.

Due to ‘other issues’ with lost memory (in the OS caused by networking issues - I believe ;-)) I have made quite a few changes since knowing this was working. I am also out of country so have a completely different network setup :-((.

If I knew what the error code is trying to tell me - I might have a chance at finding what is now causing this error …

Many Thanks

Best Regards



Well no response and I trawled the source code and can only find an undocumented reference to a WICED code 26 meaning INVALID_SOCKET.

Anyway - I resolved the problem by reviewing my code.

Since going into Manual mode (due to other issues) I had not checked if ALL my network dependent code was run AFTER connecting to the cloud etc.

So I had one Init function which called begin on my UDP :-O. When I moved that code to AFTER cloud connection - my UDP is working again ;-).

Hope this might help someone else…



Just following up with a response :smile: Happy to see you figured it out.

SUCCESS                         0 // Success
PENDING                        -1 // Pending
TIMEOUT                        -2 // Timeout
PARTIAL_RESULTS                -3 // Partial results
ERROR                          -4 // Error
BADARG                         -5 // Bad Arguments
BADOPTION                      -6 // Mode not supported
UNSUPPORTED                    -7 // Unsupported function
OUT_OF_HEAP_SPACE              -8 // Dynamic memory space exhausted
NOTUP                          -9 // Interface is not currently Up
UNFINISHED                    -10 // Operation not finished yet
CONNECTION_LOST               -11 // Connection to server lost
NOT_FOUND                     -12 // Item not found
PACKET_BUFFER_CORRUPT         -13 // Packet buffer corrupted
ROUTING_ERROR                 -14 // Routing error
BADVALUE                      -15 // Bad value
WOULD_BLOCK                   -16 // Function would block
ABORTED                       -17 // Operation aborted
CONNECTION_RESET              -18 // Connection has been reset
CONNECTION_CLOSED             -19 // Connection is closed
NOT_CONNECTED                 -20 // Connection is not connected
ADDRESS_IN_USE                -21 // Address is in use
NETWORK_INTERFACE_ERROR       -22 // Network interface error
ALREADY_CONNECTED             -23 // Socket is already connected
INVALID_INTERFACE             -24 // Interface specified in invalid
SOCKET_CREATE_FAIL            -25 // Socket creation failed
INVALID_SOCKET                -26 // Socket is invalid
CORRUPT_PACKET_BUFFER         -27 // Packet buffer is corrupted
UNKNOWN_NETWORK_STACK_ERROR   -28 // Unknown network stack error
NO_STORED_AP_IN_DCT           -29 // DCT contains no AP credentials
STA_JOIN_FAILED               -30 // Join failed
PACKET_BUFFER_OVERFLOW        -31 // Packet buffer overflow

Can anyone clarify what the -1 error “PENDING” means?

I am not completely sure but I believe it means that the WICED layer did not have a packet buffer to handle your request.

Could you be running into this problem where if you send packets back-to-back to the same host you can have buffer problems? Another case is trying to use ARP resolution with many hosts all at once and the ARP packet buffers are not returned to the pool for some time.


Can you tell us more about how you are provoking this error?

1 Like