SWRU455M February 2017 – October 2020 CC3120 , CC3120MOD , CC3130 , CC3135 , CC3135MOD , CC3220MOD , CC3220MODA , CC3220R , CC3220S , CC3220SF , CC3230S , CC3230SF , CC3235MODAS , CC3235MODASF , CC3235MODS , CC3235MODSF , CC3235S , CC3235SF
The same API starts and stops the ping process. To stop the ping process, apply value 0 in the IP field. The following parameters can be configured in the ping start command:
Example of sending an IPV4 ping request with a report for every successful ping:
_i16 Status;
SlNetAppPingReport_t report;
SlNetAppPingCommand_t pingCommand;
pingCommand.Ip = SL_IPV4_VAL(10,1,1,200); /* destination IP address is 10.1.1.200 */
pingCommand.PingSize = 150; /* size of ping, in bytes */
pingCommand.PingIntervalTime = 100; /* delay between pings, in milliseconds */
pingCommand.PingRequestTimeout = 1000; /* timeout for every ping in milliseconds */
pingCommand.TotalNumberOfAttempts = 20; /* number of ping requests */
pingCommand.Flags = 0; /* report only when finished */
Status = sl_NetAppPing( &pingCommand, SL_AF_INET, &report, NULL );
if (Status)
{
/* error */
}
Example of stopping the ping request:
_i16 Status;
SlNetAppPingCommand_t pingCommand;
pingCommand.Ip = 0;
Status = sl_NetAppPing( &pingCommand, SL_AF_INET, &report, NULL ) ;
if (Status)
{
/* error */
}
Example of sending an IPV6 infinite ping request:
_i16 Status;
SlNetAppPingReport_t report;
SlNetAppPingCommand_t pingCommand;
pingCommand.Ip = 0xFF020000; /* IPV6 Address */
pingCommand.Ip1OrPadding = 0; /* IPV6 Address */
pingCommand.Ip2OrPadding = 0; /* IPV6 Address */
pingCommand.Ip3OrPadding = 0xFB; /* IPV6 Address */
pingCommand.PingSize = 150; /* size of ping, in bytes */
pingCommand.PingIntervalTime = 100; /* delay between pings, in milliseconds */
pingCommand.PingRequestTimeout = 1000; /* timeout for every ping in milliseconds */
pingCommand.TotalNumberOfAttempts = 0; /* max number of ping requests. 0 = forever */
pingCommand.Flags = 0; /* report only when finished */
Status = sl_NetAppPing( &pingCommand, SL_AF_INET6, &report, NULL ) ;
if (Status)
{
/* error */
}