Network Component  
MDK Middleware for IPv4 and IPv6 Networking
 
Loading...
Searching...
No Matches

Function to notify the user application of critical errors in the network core. More...

Functions

void netHandleError (netErrorCode error)
 Handle Network Component critical error. [user-provided].
 

Description

Function to notify the user application of critical errors in the network core.

After a critical error, normal operation of the network component is not possible. The function netHandleError reports a critical error. The network component provides a weak implementation of this function, but you can supply your own implementation to replace the default one from the library.

Function Documentation

◆ netHandleError()

void netHandleError ( netErrorCode error)
extern

Handle Network Component critical error. [user-provided].

Parameters
[in]errorsystem error code.

The netHandleError callback function serves as a critical error handler. It is invoked when the system encounters an unrecoverable error. In such cases, the typical response is to restart the network component.

The argument error specifies the type of error that caused the function to be called.

Note
For recovery, the error is typically stored in a global variable, while cleanup and restart are handled asynchronously by another thread. This involves deinitializing the network component and its associated drivers, followed by reinitialization.

Code Example

switch (error) {
/* Out of memory */
break;
/* Trying to release non existing memory block */
break;
/* Memory Link pointer corrupted */
/* More data written than the size of allocated memory block */
break;
/* Network configuration error found */
break;
/* RTOS object creation failed (thread, semaphore, mutex) */
break;
/* Out of UDP Sockets */
break;
/* Out of TCP Sockets */
break;
/* TCP State machine in undefined state */
break;
}
while (1);
}