@Override public DatagramChannelConfig setSendBufferSize(int sendBufferSize) { try { javaSocket.setSendBufferSize(sendBufferSize); } catch (SocketException e) { throw new ChannelException(e); } return this; }
@Override public DatagramChannelConfig setSendBufferSize(int sendBufferSize) { try { javaSocket.setSendBufferSize(sendBufferSize); } catch (SocketException e) { throw new ChannelException(e); } return this; }
@Override public DatagramChannelConfig setSendBufferSize(int sendBufferSize) { try { javaSocket.setSendBufferSize(sendBufferSize); } catch (SocketException e) { throw new ChannelException(e); } return this; }
protected DatagramSocket createSocket() throws IOException { DatagramSocket s = new DatagramSocket(); s.setSendBufferSize(maxTraceDatagramSize); s.setBroadcast(broadcast); return s; }
public void setSendBufferSize(int sendBufferSize) { try { socket.setSendBufferSize(sendBufferSize); } catch (SocketException e) { throw new ChannelException(e); } }
/** * Initialize AgentMonitoringListener. * * @param port the port of the local agent * @throws SdkClientException */ public AgentMonitoringListener(int port) throws SdkClientException { try { this.dispatcher = AsynchronousAgentDispatcher.getInstance(); this.dispatcher.init(); channel = DatagramChannel.open(); channel.configureBlocking(false); if (channel.socket().getSendBufferSize() < MAX_BUFFER_SIZE) { channel.socket().setSendBufferSize(MAX_BUFFER_SIZE); } //SO_SNDBUF is just a hint and it is implementation specific if the packet is sent or discarded. maxSize = Math.min(MAX_BUFFER_SIZE, channel.socket().getSendBufferSize()); if (maxSize < MAX_BUFFER_SIZE && LOG.isDebugEnabled()) { LOG.debug(String.format("System socket buffer size %d is less than 8K. Any events larger than the buffer size " + "will be dropped", maxSize)); } channel.connect(new InetSocketAddress("localhost", port)); } catch (Exception e) { throw new SdkClientException("Failed to initialize AgentMonitoringListener", e); } }
throw log.optionOutOfRange("SEND_BUFFER"); socket.setSendBufferSize(newValue); } else if (option == Options.IP_TRAFFIC_CLASS) { old = Integer.valueOf(socket.getTrafficClass());
protected void setBufferSize(DatagramSocket sock, int send_buf_size, int recv_buf_size) { try { sock.setSendBufferSize(send_buf_size); int actual_size=sock.getSendBufferSize(); if(actual_size < send_buf_size && log.isWarnEnabled()) { log.warn(Util.getMessage("IncorrectBufferSize"), "send", sock.getClass().getSimpleName(), Util.printBytes(send_buf_size), Util.printBytes(actual_size), "send", "net.core.wmem_max"); } } catch(Throwable ex) { log.warn(Util.getMessage("BufferSizeFailed"), "send", send_buf_size, sock, ex); } try { sock.setReceiveBufferSize(recv_buf_size); int actual_size=sock.getReceiveBufferSize(); if(actual_size < recv_buf_size && log.isWarnEnabled()) { log.warn(Util.getMessage("IncorrectBufferSize"), "receive", sock.getClass().getSimpleName(), Util.printBytes(recv_buf_size), Util.printBytes(actual_size), "receive", "net.core.rmem_max"); } } catch(Throwable ex) { log.warn(Util.getMessage("BufferSizeFailed"), "receive", recv_buf_size, sock, ex); } }
/** {@inheritDoc} */ public MulticastMessageChannel createUdpServer(final InetSocketAddress bindAddress, final ChannelListener<? super MulticastMessageChannel> bindListener, final OptionMap optionMap) throws IOException { checkShutdown(); final DatagramChannel channel; if (bindAddress != null) { InetAddress address = bindAddress.getAddress(); if (address instanceof Inet6Address) { channel = DatagramChannel.open(StandardProtocolFamily.INET6); } else { channel = DatagramChannel.open(StandardProtocolFamily.INET); } } else { channel = DatagramChannel.open(); } channel.configureBlocking(false); if (optionMap.contains(Options.BROADCAST)) channel.socket().setBroadcast(optionMap.get(Options.BROADCAST, false)); if (optionMap.contains(Options.IP_TRAFFIC_CLASS)) channel.socket().setTrafficClass(optionMap.get(Options.IP_TRAFFIC_CLASS, -1)); if (optionMap.contains(Options.RECEIVE_BUFFER)) channel.socket().setReceiveBufferSize(optionMap.get(Options.RECEIVE_BUFFER, -1)); channel.socket().setReuseAddress(optionMap.get(Options.REUSE_ADDRESSES, true)); if (optionMap.contains(Options.SEND_BUFFER)) channel.socket().setSendBufferSize(optionMap.get(Options.SEND_BUFFER, -1)); channel.socket().bind(bindAddress); final NioUdpChannel udpChannel = new NioUdpChannel(this, channel); ChannelListeners.invokeChannelListener(udpChannel, bindListener); return udpChannel; }
DatagramSocket out = new DatagramSocket(); if (this.soSendBufferSize > 0) { out.setSendBufferSize(this.soSendBufferSize);
protected void setSocketAttributes(DatagramSocket socket) throws SocketException { if (this.getSoTimeout() >= 0) { socket.setSoTimeout(this.getSoTimeout()); } if (this.getSoSendBufferSize() > 0) { socket.setSendBufferSize(this.getSoSendBufferSize()); } }
/** * Initialize AgentMonitoringListener. * * @param port the port of the local agent * @throws SdkClientException */ public AgentMonitoringListener(int port) throws SdkClientException { try { this.dispatcher = AsynchronousAgentDispatcher.getInstance(); this.dispatcher.init(); channel = DatagramChannel.open(); channel.configureBlocking(false); if (channel.socket().getSendBufferSize() < MAX_BUFFER_SIZE) { channel.socket().setSendBufferSize(MAX_BUFFER_SIZE); } //SO_SNDBUF is just a hint and it is implementation specific if the packet is sent or discarded. maxSize = Math.min(MAX_BUFFER_SIZE, channel.socket().getSendBufferSize()); if (maxSize < MAX_BUFFER_SIZE && LOG.isDebugEnabled()) { LOG.debug(String.format("System socket buffer size %d is less than 8K. Any events larger than the buffer size " + "will be dropped", maxSize)); } channel.connect(new InetSocketAddress("localhost", port)); } catch (Exception e) { throw new SdkClientException("Failed to initialize AgentMonitoringListener", e); } }
channel.socket().setSendBufferSize(sendBufferSize);
protected DatagramSocket createSocket() throws IOException { DatagramSocket s = new DatagramSocket(); s.setSendBufferSize(maxTraceDatagramSize); s.setBroadcast(broadcast); return s; }
@Override public DatagramChannelConfig setSendBufferSize(int sendBufferSize) { try { javaSocket.setSendBufferSize(sendBufferSize); } catch (SocketException e) { throw new ChannelException(e); } return this; }
@Override public DatagramChannelConfig setSendBufferSize(int sendBufferSize) { try { javaSocket.setSendBufferSize(sendBufferSize); } catch (SocketException e) { throw new ChannelException(e); } return this; }
protected DatagramSocket createSocket() throws IOException { DatagramSocket s = new DatagramSocket(); s.setSendBufferSize(maxTraceDatagramSize); s.setBroadcast(broadcast); return s; }
protected void setSocketAttributes(DatagramSocket socket) throws SocketException { if (this.getSoTimeout() >= 0) { socket.setSoTimeout(this.getSoTimeout()); } if (this.getSoSendBufferSize() > 0) { socket.setSendBufferSize(this.getSoSendBufferSize()); } }
@Override public void setSendBufferSize(int sendBufferSize) { if (DatagramSessionConfigImpl.isSetSendBufferSizeAvailable()) { try { ch.socket().setSendBufferSize(sendBufferSize); } catch (SocketException e) { throw new RuntimeIOException(e); } } }
private void setSndBuf(IRubyObject val) throws IOException { Channel socketChannel = openFile.getMainStream().getDescriptor().getChannel(); if(socketChannel instanceof SocketChannel) { asSocket().setSendBufferSize(asNumber(val)); } else if(socketChannel instanceof DatagramChannel) { asDatagramSocket().setSendBufferSize(asNumber(val)); } }