I have trouble to retrieve the connected client(s) of a net. I would be grateful for a hint regarding this matter.
I tried the follwing, but it doesn' seem to work.
Code: Select all
StringBuilder asNetName = new StringBuilder(CanApi2.MAX_HCANCLIENT + 1);
for (byte u8Handle = 0; u8Handle <= CanApi2.MAX_HCANNET; u8Handle++)
{
ECanErr eVar = (ECanErr)CanApi2.GetNetParam(u8Handle, CanApi2.PARAM_NETCLIENTS, asNetName, CanApi2.MAX_HCANCLIENT + 1);
if (eVar == ECanErr.OK)
{
if (asNetName.ToString().Equals(sNetName))
{
Console.WriteLine(string.Format("{0} {1}", u8Handle, asNetName.ToString()));
}
}
}