Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** Constructor */
- private MulticastChannel() {
- /** configuration via properties file, terminate if not found! */
- String address = constants.get(ZephyrOpen.address);
- String port = constants.get(ZephyrOpen.port);
- if (address == null) {
- constants.error("serverAddress not found in properties file, terminate!", this);
- constants.shutdown();
- }
- if (port == null) {
- constants.error("serverPort not found in properties file, terminate!", this);
- constants.shutdown();
- }
- try {
- groupPort = Integer.parseInt(port);
- /** get group ip */
- groupAddress = InetAddress.getByName(address);
- /** construct the server socket */
- serverSocket = new MulticastSocket(groupPort);
- /** join this group */
- serverSocket.joinGroup(groupAddress);
- /** find our ip */
- local = constants.get(ZephyrOpen.localAddress);
- } catch (Exception e) {
- constants.shutdown(e);
- }
- /** start thread, block wait on input from socket */
- server = new Thread(this);
- server.setDaemon(true);
- server.start();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement