Package it.hakvoort.bdf.example

Source Code of it.hakvoort.bdf.example.JavaBDFServerExample

package it.hakvoort.bdf.example;

import java.io.IOException;

import it.hakvoort.bdf.BDFException;
import it.hakvoort.bdf.BDFFile;
import it.hakvoort.bdf.BDFReader;
import it.hakvoort.bdf.network.BDFServer;

/**
*
* @author Gido Hakvoort (gido@hakvoort.it)
*
*/
public class JavaBDFServerExample {

  public JavaBDFServerExample() throws IOException, BDFException {
   
    // create a BDFFile
    BDFFile bdf = BDFFile.open("data/bdf/example.bdf");
   
    // get the bdf reader
    BDFReader reader = bdf.getReader();
   
    // set the reader to start at the beginning of the file when it reached the end
    reader.setRepeat(true);
   
    // create and start a BDFNetworkServer
    BDFServer server = new BDFServer(reader, 4321);
   
    // start the server
    server.start();
  }
 
  public static void main(String[] args) {
    try {
      new JavaBDFServerExample();
    } catch (IOException e) {
      e.printStackTrace();
    } catch (BDFException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
}
TOP

Related Classes of it.hakvoort.bdf.example.JavaBDFServerExample

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.