Skip to main content
Open topic with navigation CAPL Functions » TCP/IP API » IpGetAddressAsNumber

IpGetAddressAsNumber

Valid for: CANoe DE • CANoe4SW DE

Function Syntax

dword IpGetAddressAsNumber( char address[]);

Description

The function converts an IPv4 address string in dot notation to its numerical value in network-byte order.

Parameters

  • address: The numerical IPv4 address to be converted.

Return Values

  • 4294967295 (0xFFFFFFF, the equivalent of “255.255.255.255”): The specified address string was invalid.
  • Any other value: The numeric equivalent of the given IPv4 address string.

Example

on start
{
  const dword IPV4_STR_SIZE = 16;   // IPv4 string size
  char ipv4AddrStr[IPV4_STR_SIZE] = "129.168.111.222";

  write("Converting IPv4 Address %s to numerical value => 0x%x", ipv4AddrStr, IpGetAddressAsNumber(ipv4AddrStr));
}