HostAddress

Aug 10, 2010 at 1:01 PM

Hi,

I can't seem to to get the hostaddress or the device ipaddress.

I am using the following

Dim _remoteDeviceManager As New RemoteDeviceManager
Dim _remoteDevice As RemoteDevice = R.Devices.FirstConnectedDevice
If I then try to use "_remoteDevice.dev.HostAddress.Address", I get an error as the hostaddress and ipaddress = Nothing.


I am obviously doing something wrong, but I can get the other values such as Name etc..
Regards,


Matt
Nov 28, 2011 at 9:45 AM
Edited Nov 28, 2011 at 9:47 AM

The System.Devices.RemoteDevice.RAPIConnectionInfo class assigns the host and addr fields only if the connection type is a network connection. As a workaround i modifed the RAPIConnectionInfo class as follows.

private class RAPIConnectionInfo
{
  public RAPIConnectionInfo(RAPI_CONNECTIONINFO ci)
  {
     this.connType = ci.connectionType;
     try
     {
       addr = new System.Net.IPEndPoint(ci.ipaddr.addr, ci.ipaddr.port);
     }
     catch (ArgumentOutOfRangeException)
     {
     }
     try
     {
       host = new System.Net.IPEndPoint(ci.hostIpaddr.addr, ci.hostIpaddr.port);
     }
     catch (ArgumentOutOfRangeException)
     {
     }
  }
}

Rajkiran