lr.get_vuser_ip

Returns the IP address of a Vuser.

C#

string lr.get_vuser_ip( );

VB.NET

Function lr.get_vuser_ip( ) as String
Alphabetical Listing

Arguments

NameComments
N/A 

The lr.get_vuser_ip function returns the IPv4 address of a Vuser. When performing IP spoofing, each Vuser can use a different address. This function allows you to determine the current Vuser's IP address.

If the IP was set with the web.set_sockets_option function using the IP_ADDRESS_BY_INDEX option, lr.get_vuser_ip returns that IP.

If lr.get_vuser_ip fails, or if working with multiple IP addresses is disabled, IP is NULL.

To get an IPv6 address, use lr.get_attrib_string("ipv6") .

Return Values

The IPv4 address. If function fails, or if working with multiple IP addresses is disabled, returns null.

Parameterization

Parameterization is not applicable to this function.

Example

The following example retrieves the IP address of the current Vuser.

string vuserip=lr.get_vuser_ip();

if(vuserip==null)

lr.output_message("Failed to get the Vuser IP address");

else

lr.output_message("Vuser IP = " + vuserip);