GetAddress
-
hi,
today the cvs is a little bit broken.
in localDevice.java the getAddress calls the wrong constructor:
private byte[] getLocalIPAddress() throws UnknownHostException, SocketException
{
Enumeration<NetworkInterface> netInter = NetworkInterface.getNetworkInterfaces();
int n = 0;while (netInter.hasMoreElements()) { NetworkInterface ni = netInter.nextElement(); System.out.println("NetworkInterface " + n++ + ": " + ni.getDisplayName()); for (InetAddress iaddress : Collections.list(ni.getInetAddresses())) { System.out.println("CanonicalHostName: " + iaddress.getCanonicalHostName()); System.out.println("IP: " + iaddress.getHostAddress()); System.out.println("Loopback? " + iaddress.isLoopbackAddress()); System.out.println("SiteLocal? " + iaddress.isSiteLocalAddress()); System.out.println(); if (false == iaddress.isLoopbackAddress() && iaddress.isSiteLocalAddress()) return iaddress.getAddress(); } } return InetAddress.getLocalHost().getAddress(); } public Address getAddress() { try { return new Address(null, getLocalIPAddress(), messageControl.getPort()); } catch (UnknownHostException e) { // Should never happen, so just wrap in a RuntimeException throw new RuntimeException(e); } catch (SocketException e) { // Should never happen, so just wrap in a RuntimeException throw new RuntimeException(e); } }
in the class Address the networkNumber member has to of type Unsigned16.
correct all compiling errrors and you are ready to add yourself as listener in the notification objects.regards
robertyou can change that quickly.
-
Hi Robert,
Not sure what you are saying is broken since getLocalIPAddress is not in the CVS version of the class.
-
hi matt,
broken means that as local address 127.0.0.1 is returned. plus the bacnet port is being used as bacnet network number.
at least our app did not work anymore after updating from cvs. .now it should again after your latest fixes.best regards
robert