public void close() throws ChannelException { logger.trace("close() - entry"); try { MulticastSocket socket = (MulticastSocket) getSocket(); if (socket != null) { socket.leaveGroup(getGroup()); } super.close(); } catch (IOException ex) { logger.error("close() - Error closing sockets", ex); } logger.trace("close() - exit"); }
public void open() throws ChannelException { if (logger.isTraceEnabled()) logger.trace("open() - entry"); if (socket == null) { try { socket = new MulticastSocket(getPort()); socket.joinGroup(getGroup()); } catch (UnknownHostException e) { logger.error("open() - Unknown multicast group " + getGroup(), e); throw new ChannelException("Unknown multicast group " + getGroup()); } catch (IOException e) { logger.error("open() - Socket construction failed on port " + port, e); throw new ChannelException("Socket construction failed on port " + port); } } super.open(); if (logger.isTraceEnabled()) logger.trace("open() - exit"); }