protected void closeUnicastSocket() { getSocketFactory().close(sock); }
protected MulticastSocket createMulticastSocket(String service_name, int port) throws Exception { // Creates an *unbound* multicast socket (because SocketAddress is null) MulticastSocket retval=getSocketFactory().createMulticastSocket(service_name, null); // causes *no* binding ! if(bind_addr != null) setInterface(bind_addr, retval); retval.setReuseAddress(false); // so we get a conflict if binding to the same port and increment the port retval.bind(new InetSocketAddress(bind_addr, port)); return retval; }
void closeMulticastSocket() { if(mcast_sock != null) { try { if(mcast_addr != null) { mcast_sock.leaveGroup(mcast_addr.getIpAddress()); } getSocketFactory().close(mcast_sock); // this will cause the mcast receiver thread to break out of its loop mcast_sock=null; if(log.isDebugEnabled()) log.debug("multicast socket closed"); } catch(IOException ex) { } mcast_addr=null; } }
mcast_sock=Util.createMulticastSocket(getSocketFactory(), "jgroups.udp.mcast_sock", mcast_group_addr, mcast_port, log); else mcast_sock=getSocketFactory().createMulticastSocket("jgroups.udp.mcast_sock", mcast_port);
protected void closeUnicastSocket() { getSocketFactory().close(sock); }
protected MulticastSocket createMulticastSocket(String service_name, int port) throws Exception { // Creates an *unbound* multicast socket (because SocketAddress is null) MulticastSocket retval=getSocketFactory().createMulticastSocket(service_name, null); // causes *no* binding ! if(bind_addr != null) setInterface(bind_addr, retval); retval.setReuseAddress(false); // so we get a conflict if binding to the same port and increment the port retval.bind(new InetSocketAddress(bind_addr, port)); return retval; }
void closeMulticastSocket() { if(mcast_sock != null) { try { if(mcast_addr != null) { mcast_sock.leaveGroup(mcast_addr.getIpAddress()); } getSocketFactory().close(mcast_sock); // this will cause the mcast receiver thread to break out of its loop mcast_sock=null; if(log.isDebugEnabled()) log.debug("multicast socket closed"); } catch(IOException ex) { } mcast_addr=null; } }
mcast_sock=Util.createMulticastSocket(getSocketFactory(), "jgroups.udp.mcast_sock", mcast_group_addr, mcast_port, log); else mcast_sock=getSocketFactory().createMulticastSocket("jgroups.udp.mcast_sock", mcast_port);