*/
public class BDF2TCPExample implements BDFListener {
public BDF2TCPExample() {
// create a BDFReader
BDFReader reader = new BDFReader("data/bdf/example.bdf");
// create and start a BDFNetworkServer
BDFNetworkServer server = new BDFNetworkServer(reader, 4321);
server.start();
// wait a second
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
// The number of channels which are send by the server and read by the client must be the same! If not, data will be incorrect.
int channels = reader.getHeader().getNumChannels();
// create a BDFNetworkClient
BDFNetworkClient client = new BDFNetworkClient("localhost", 4321, channels);
client.addListener(this);