If i run a test program i am getting an timeout error, i am using the latest version of bacnet4j from sourceforge...
That is version 1.2 "http://sourceforge.net/projects/bacnet4j/files/bacnet4j/1.2/"
Below is the program
import java.net.InetAddress;
import java.net.InetSocketAddress;
import com.serotonin.bacnet4j.LocalDevice;
import com.serotonin.bacnet4j.RemoteDevice;
import com.serotonin.bacnet4j.event.DefaultDeviceEventListener;
import com.serotonin.bacnet4j.service.acknowledgement.ReadPropertyAck;
import com.serotonin.bacnet4j.service.confirmed.ReadPropertyRequest;
import com.serotonin.bacnet4j.type.Encodable;
import com.serotonin.bacnet4j.type.constructed.Address;
import com.serotonin.bacnet4j.type.constructed.SequenceOf;
import com.serotonin.bacnet4j.type.enumerated.ObjectType;
import com.serotonin.bacnet4j.type.enumerated.PropertyIdentifier;
import com.serotonin.bacnet4j.type.enumerated.Segmentation;
import com.serotonin.bacnet4j.type.primitive.ObjectIdentifier;
public class Test2 {
public static void main(String[] args) throws Exception {
LocalDevice localDevice = new LocalDevice(1968, "255.255.255.255");
localDevice.getEventHandler().addListener(new Listener());
localDevice.setPort(47808);
localDevice.initialize();
getObjectList(localDevice, "192.168.1.3", 0xBAC0, 260001);
localDevice.terminate();
}
private static void getObjectList(LocalDevice localDevice, String ip, int port, int deviceId) throws Exception {
InetSocketAddress addr = new InetSocketAddress(InetAddress.getByName(ip), port);
System.out.println(""+addr);
ReadPropertyRequest read = new ReadPropertyRequest(new ObjectIdentifier(ObjectType.device, deviceId),
PropertyIdentifier.objectList);
Thread.sleep(1000);
ReadPropertyAck ack = (ReadPropertyAck) localDevice.send(addr, null, 1476, Segmentation.segmentedBoth, read);
Thread.sleep(1000);
System.out.println("IP: " + ip);
SequenceOf<ObjectIdentifier> oids = (SequenceOf<ObjectIdentifier>) ack.getValue();
for (ObjectIdentifier oid : oids)
System.out.println(" " + oid);
}
static class Listener extends DefaultDeviceEventListener {
@Override
public void iAmReceived(RemoteDevice d) {
System.out.println("IAm received" + d);
}
}
}
Everytime if i run this program i am getting the Timeout error:
Exception in thread "main" com.serotonin.bacnet4j.exception.BACnetTimeoutException: Timeout while waiting for response for id 0
at com.serotonin.bacnet4j.npdu.ip.IpMessageControl.send(IpMessageControl.java:314)
at com.serotonin.bacnet4j.npdu.ip.IpMessageControl.send(IpMessageControl.java:249)
at com.serotonin.bacnet4j.LocalDevice.send(LocalDevice.java:480)
at Test2.getObjectList(Test2.java:44)
at Test2.main(Test2.java:29)
Able to see the response from the device using wireshark and since bacnet4j is not able to receive the complex ack from the device it will be keep polling and finally timeout error will be thrown..
Even i tried using the latest code available in CVS --->"http://bacnet4j.cvs.sourceforge.net/viewvc/bacnet4j/BACnet4J/" but still the same error results. Can you please help is there something wrong i am doing?
Can you please resolve this issue :roll:
I am finding this issue more on WIFI network not wired, with wired network some times it works fine