Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

for linux #4

Open
ZeratulBrale opened this issue Nov 22, 2018 · 1 comment
Open

for linux #4

ZeratulBrale opened this issue Nov 22, 2018 · 1 comment

Comments

@ZeratulBrale
Copy link

i cannot get anny device when i start on Centos,windows can find

@krishna444
Copy link

I have also a similar issue with OpenJDK version 1.0.0_191.
The same version in my Windows10 machine works perfectly fine. Please have a looks at the sample code. This problem is very frustrating!

/** Source code**/
package com.frietec.bacnet;

import com.serotonin.bacnet4j.LocalDevice;
import com.serotonin.bacnet4j.RemoteDevice;
import com.serotonin.bacnet4j.RemoteObject;
import com.serotonin.bacnet4j.event.DeviceEventAdapter;
import com.serotonin.bacnet4j.npdu.ip.IpNetwork;
import com.serotonin.bacnet4j.npdu.ip.IpNetworkBuilder;
import com.serotonin.bacnet4j.service.unconfirmed.WhoIsRequest;
import com.serotonin.bacnet4j.transport.DefaultTransport;
import com.serotonin.bacnet4j.transport.Transport;

public class SampleTestProgram {
	public static void main(String... args) throws Exception {
		IpNetwork network = new IpNetworkBuilder().withPort(Integer.decode("0xBAC0")).withSubnet("255.255.255.0", 24).withLocalBindAddress("192.168.1.28").build();
		Transport transport = new DefaultTransport(network);
		transport.setTimeout(30000);
		transport.setSegTimeout(30000);
		LocalDevice localDevice = new LocalDevice(56789, transport);

		try {
			localDevice.getEventHandler().addListener(new DeviceEventAdapter() {
				public void iAmReceived(RemoteDevice device) {
					System.out.println(device);
				}

				@Override
				public void iHaveReceived(RemoteDevice device, RemoteObject object) {
					System.out.println("Value reported " + device + " " + object);
				}
			});
			localDevice.initialize();
			localDevice.sendLocalBroadcast(new WhoIsRequest());
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants