This parameter applies only to hardware of type PcanLan. It is used to distinguish between 2 or more hardware of this kind connected to a computer simultaneously. An IP address represents the configured network address on a PCAN-Gateway device, i.e., the address used to communicate with a PCAN-Gateway device through the network (LAN/WAN).
The IP address identifies a device effectively because it is not allowed to have the same IP address twice within a network, at the same time (address conflict).
This parameter can be used when it is needed to differentiate between PCAN-Gateway devices connected to the same system at a given time, or just to get more information about a remote PCAN-Gateway device through its IP address.
Available since PCAN-Basic version 4.0.0.
It can be read without initialization since version 4.6.1.
This parameter can only be read. It cannot be modified.
Since the format used for the IP address is IPv4, possible values are string representing 4 number sections separated by ‘.’, which are in the range [0…255]. Example of an IP address is: “192.168.0.1”.
Does not apply.
Get: It can be read on initialized or uninitialized PCAN Channels.
The following code shows how to retrieve the IP address of a LAN Channel. The BitrateAdapting parameter is used to facilitate the connection to any available PCAN-LAN Channel:
PcanChannel[] channelsToCheck = { PcanChannel.Lan01, PcanChannel.Lan02, PcanChannel.Lan03 };
string ipAddress;
for (int i = 0; i < 3; i++)
{
if (Api.SetValue(channelsToCheck[i], PcanParameter.BitrateAdapting, ParameterValue.Activation.On) == PcanStatus.OK)
{
PcanStatus result = Api.Initialize(channelsToCheck[i], Bitrate.Pcan500);
if ((result == PcanStatus.OK) || (result == PcanStatus.Caution))
{
if (Api.GetValue(channelsToCheck[i], PcanParameter.IpAddress, out ipAddress) == PcanStatus.OK)
{
Console.WriteLine($"Associated IP address of {channelsToCheck[i]}: {ipAddress}");
}
Api.Uninitialize(channelsToCheck[i]);
}
else
Console.WriteLine($"Error while trying to initialize the Channel {channelsToCheck[i]}");
}
else
Console.WriteLine($"Error while trying to activate the parameter BitrateAdapting for the {channelsToCheck[i]}");
}Dim channelsToCheck As PcanChannel() = {PcanChannel.Lan01, PcanChannel.Lan02, PcanChannel.Lan03}
Dim ipAddress As String = Nothing
For i = 0 To 2
If Api.SetValue(channelsToCheck(i), PcanParameter.BitrateAdapting, ParameterValue.Activation.On) = PcanStatus.OK Then
Dim result As PcanStatus = Api.Initialize(channelsToCheck(i), Bitrate.Pcan500)
If result = PcanStatus.OK OrElse result = PcanStatus.Caution Then
If Api.GetValue(channelsToCheck(i), PcanParameter.IpAddress, ipAddress) = PcanStatus.OK Then
Console.WriteLine($"Associated IP address of {channelsToCheck(i)}: {ipAddress}")
End If
Api.Uninitialize(channelsToCheck(i))
Else
Console.WriteLine($"Error while trying to initialize the Channel {channelsToCheck(i)}")
End If
Else
Console.WriteLine($"Error while trying to activate the parameter BitrateAdapting for the {channelsToCheck(i)}")
End If
Nextarray<PcanChannel>^ channelsToCheck = { PcanChannel::Lan01, PcanChannel::Lan02, PcanChannel::Lan03 };
String^ ipAddress;
for (int i = 0; i < 3; i++)
{
if (Api::SetValue(channelsToCheck[i], PcanParameter::BitrateAdapting, ParameterValue::Activation::On) == PcanStatus::OK)
{
PcanStatus result = Api::Initialize(channelsToCheck[i], Bitrate::Pcan500);
if ((result == PcanStatus::OK) || (result == PcanStatus::Caution))
{
if (Api::GetValue(channelsToCheck[i], PcanParameter::IpAddress, ipAddress) == PcanStatus::OK)
{
Console::WriteLine("Associated IP address of {0}: {1}", channelsToCheck[i], ipAddress);
}
Api::Uninitialize(channelsToCheck[i]);
}
else
Console::WriteLine("Error while trying to initialize the Channel {0}", channelsToCheck[i]);
}
else
Console::WriteLine("Error while trying to activate the parameter BitrateAdapting for the {0}", channelsToCheck[i]);
}