Applicable Versions | NetSim Standard | NetSim Pro |
NOTE: Procedure may vary for different releases of NetSim. Please follow the steps mentioned under the applicable release.
Applicable Releases | v13 |
The NetSim API RPL_IP_TO_STR(ip) ((ip)->str_ip) can be used to convert a device NETSIM_IP Address type variable to a string.
For Example
RPL_IP_TO_STR(szSrcIPadd,sip);//Converting Source IP address
RPL_IP_TO_STR(szDestIPadd,dip);//Converting Destination IP address
fprintf(stdout,"%s, %s,",sip,dip); // Printing IP to console
In order to compare IP addresses, IP addresses has to be converted into strings initially using the RPL_IP_TO_STR() API and then strcmp(const char* str1, const char* str2) function can be used to compare any two IP address strings.
Applicable Releases | v11 | v12 |
The NetSim API IP_TO_STR(ip) can be used to convert a device NETSIM_IP Address type variable to a string.
For Example
IP_TO_STR(szSrcIPadd,sip);//Converting Source IP address
IP_TO_STR(szDestIPadd,dip);//Converting Destination IP address
fprintf(stdout,"%s, %s,",sip,dip); // Printing IP to console
In order to compare IP addresses, IP addresses has to be converted into strings initially using the IP_TO_STR() API and then strcmp(const char* str1, const char* str2) function can be used to compare any two IP address strings.
Related Articles: