@Override public void openClient() throws Exception { // HORNETQ-874 if (checkForLinux() || checkForSolaris() || checkForHp()) { try { receivingSocket = new MulticastSocket(new InetSocketAddress(groupAddress, groupPort)); } catch (IOException e) { ActiveMQClientLogger.LOGGER.ioDiscoveryError(groupAddress.getHostAddress(), groupAddress instanceof Inet4Address ? "IPv4" : "IPv6"); receivingSocket = new MulticastSocket(groupPort); } } else { receivingSocket = new MulticastSocket(groupPort); } if (localAddress != null) { receivingSocket.setInterface(localAddress); } receivingSocket.joinGroup(groupAddress); receivingSocket.setSoTimeout(SOCKET_TIMEOUT); open = true; }
/** * Create a new instance from the given {@link MulticastSocket}. * * @param socket the {@link MulticastSocket} which is used by this instance */ public OioDatagramChannel(MulticastSocket socket) { super(null); boolean success = false; try { socket.setSoTimeout(SO_TIMEOUT); socket.setBroadcast(false); success = true; } catch (SocketException e) { throw new ChannelException( "Failed to configure the datagram socket timeout.", e); } finally { if (!success) { socket.close(); } } this.socket = socket; config = new DefaultOioDatagramChannelConfig(this, socket); }
mcast.joinGroup(inetAddress); mcast.setSoTimeout((int)keepAliveInterval); if (mcInterface != null) { mcast.setInterface(InetAddress.getByName(mcInterface));
/** * Create a new instance from the given {@link MulticastSocket}. * * @param socket the {@link MulticastSocket} which is used by this instance */ public OioDatagramChannel(MulticastSocket socket) { super(null); boolean success = false; try { socket.setSoTimeout(SO_TIMEOUT); socket.setBroadcast(false); success = true; } catch (SocketException e) { throw new ChannelException( "Failed to configure the datagram socket timeout.", e); } finally { if (!success) { socket.close(); } } this.socket = socket; config = new DefaultOioDatagramChannelConfig(this, socket); }
InetAddress localHost = SocketCreator.getLocalHost(); socket.setInterface(localHost); socket.setSoTimeout(Integer.getInteger("AvailablePort.timeout", 2000).intValue()); socket.setReuseAddress(true); byte[] buffer = new byte[4];
boolean error = false; try { upnpMulticastSocket.setSoTimeout((int) Configuration.UPNP_NOTIFY_TIMEOUT); } catch (SocketException e1) { log.warn("Could not sent soTimeout on multi-cast socket");
protected CommandChannel createCommandChannel() throws IOException { socket = new MulticastSocket(mcastPort); socket.setLoopbackMode(loopBackMode); socket.setTimeToLive(timeToLive); LOG.debug("Joining multicast address: " + getMulticastAddress()); socket.joinGroup(getMulticastAddress()); socket.setSoTimeout((int)keepAliveInterval); return new CommandDatagramSocket(this, getWireFormat(), getDatagramSize(), getTargetAddress(), createDatagramHeaderMarshaller(), getSocket()); }
/** * Create a new instance from the given {@link MulticastSocket}. * * @param socket the {@link MulticastSocket} which is used by this instance */ public OioDatagramChannel(MulticastSocket socket) { super(null); boolean success = false; try { socket.setSoTimeout(SO_TIMEOUT); socket.setBroadcast(false); success = true; } catch (SocketException e) { throw new ChannelException( "Failed to configure the datagram socket timeout.", e); } finally { if (!success) { socket.close(); } } this.socket = socket; config = new DefaultOioDatagramChannelConfig(this, socket); }
OioDatagramChannel( ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink) { super(null, factory, pipeline, sink); try { socket = new MulticastSocket(null); } catch (IOException e) { throw new ChannelException("Failed to open a datagram socket.", e); } try { socket.setSoTimeout(10); socket.setBroadcast(false); } catch (SocketException e) { throw new ChannelException( "Failed to configure the datagram socket timeout.", e); } config = new DefaultDatagramChannelConfig(socket); fireChannelOpen(this); }
sock.setInterface(sockItf); sock.setSoTimeout(resWaitTime);
socket.setSoTimeout(config.getSocketTimeout());
MulticastSocket socket1 = new MulticastSocket(testPort); socket1.setInterface(InetAddress.getByName(multicastRule.getNic())); socket1.setSoTimeout(8000); InetAddress group = InetAddress.getByName(multicastAddress); socket1.joinGroup(group);
public MulticastSearch(final String host, final int port) throws IOException { final InetAddress inetAddress = InetAddress.getByName(host); multicast = new MulticastSocket(port); multicast.joinGroup(inetAddress); multicast.setSoTimeout(500); }
public MulticastSearch(String host, int port) throws IOException { InetAddress inetAddress = InetAddress.getByName(host); multicast = new MulticastSocket(port); multicast.joinGroup(inetAddress); multicast.setSoTimeout(500); }
public MulticastSearch(final String host, final int port) throws IOException { final InetAddress inetAddress = InetAddress.getByName(host); multicast = new MulticastSocket(port); multicast.joinGroup(inetAddress); multicast.setSoTimeout(500); }
public MulticastSearch(String host, int port) throws IOException { InetAddress inetAddress = InetAddress.getByName(host); multicast = new MulticastSocket(port); multicast.joinGroup(inetAddress); multicast.setSoTimeout(500); }
synchronized private void createSocket(InetAddress address) throws IOException { if (multicastSocket != null) { multicastSocket.close(); } // create socket multicastSocket = new MulticastSocket(PORT); multicastSocket.setReuseAddress(true); multicastSocket.setSoTimeout(130000); multicastSocket.joinGroup(address); sendDiscoveryPacket(); multicastSocket.setSoTimeout(2000); }
protected CommandChannel createCommandChannel() throws IOException { socket = new MulticastSocket(mcastPort); socket.setLoopbackMode(loopBackMode); socket.setTimeToLive(timeToLive); LOG.debug("Joining multicast address: " + getMulticastAddress()); socket.joinGroup(getMulticastAddress()); socket.setSoTimeout((int)keepAliveInterval); return new CommandDatagramSocket(this, getWireFormat(), getDatagramSize(), getTargetAddress(), createDatagramHeaderMarshaller(), getSocket()); }
protected CommandChannel createCommandChannel() throws IOException { socket = new MulticastSocket(mcastPort); socket.setLoopbackMode(loopBackMode); socket.setTimeToLive(timeToLive); LOG.debug("Joining multicast address: " + getMulticastAddress()); socket.joinGroup(getMulticastAddress()); socket.setSoTimeout((int)keepAliveInterval); return new CommandDatagramSocket(this, getWireFormat(), getDatagramSize(), getTargetAddress(), createDatagramHeaderMarshaller(), getSocket()); }
protected CommandChannel createCommandChannel() throws IOException { socket = new MulticastSocket(mcastPort); socket.setLoopbackMode(loopBackMode); socket.setTimeToLive(timeToLive); LOG.debug("Joining multicast address: " + getMulticastAddress()); socket.joinGroup(getMulticastAddress()); socket.setSoTimeout((int)keepAliveInterval); return new CommandDatagramSocket(this, getWireFormat(), getDatagramSize(), getTargetAddress(), createDatagramHeaderMarshaller(), getSocket()); }