@Override public DatagramChannelConfig setReceiveBufferSize(int receiveBufferSize) { try { javaSocket.setReceiveBufferSize(receiveBufferSize); } catch (SocketException e) { throw new ChannelException(e); } return this; }
@Override public DatagramChannelConfig setReceiveBufferSize(int receiveBufferSize) { try { javaSocket.setReceiveBufferSize(receiveBufferSize); } catch (SocketException e) { throw new ChannelException(e); } return this; }
@Override public DatagramChannelConfig setReceiveBufferSize(int receiveBufferSize) { try { javaSocket.setReceiveBufferSize(receiveBufferSize); } catch (SocketException e) { throw new ChannelException(e); } return this; }
public void setReceiveBufferSize(int receiveBufferSize) { try { socket.setReceiveBufferSize(receiveBufferSize); } catch (SocketException e) { throw new ChannelException(e); } }
throw log.optionOutOfRange("RECEIVE_BUFFER"); socket.setReceiveBufferSize(newValue); } else if (option == Options.SEND_BUFFER) { old = Integer.valueOf(socket.getSendBufferSize());
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; }
/** * Sets timeout and receive buffer size * * @param socket The socket. * @throws SocketException Any socket exception. */ protected void setSocketAttributes(DatagramSocket socket) throws SocketException { socket.setSoTimeout(this.getSoTimeout()); int soReceiveBufferSize = this.getSoReceiveBufferSize(); if (soReceiveBufferSize > 0) { socket.setReceiveBufferSize(soReceiveBufferSize); } }
protected synchronized DatagramSocket getSocket() throws IOException { if (this.socket == null) { if (this.acknowledge) { if (this.localAddress == null) { this.socket = this.ackPort == 0 ? new DatagramSocket() : new DatagramSocket(this.ackPort); } else { InetAddress whichNic = InetAddress.getByName(this.localAddress); this.socket = new DatagramSocket(new InetSocketAddress(whichNic, this.ackPort)); } if (this.soReceiveBufferSize > 0) { this.socket.setReceiveBufferSize(this.soReceiveBufferSize); } if (logger.isDebugEnabled()) { logger.debug("Listening for acks on port: " + getAckPort()); } updateAckAddress(); } else { this.socket = new DatagramSocket(); } setSocketAttributes(this.socket); } return this.socket; }
@Override protected void setReceiveBufferSize(int receiveBufferSize) throws IOException { socket.setReceiveBufferSize(receiveBufferSize); } }
channel.socket().setReceiveBufferSize(readBufferSize);
@Override public DatagramChannelConfig setReceiveBufferSize(int receiveBufferSize) { try { javaSocket.setReceiveBufferSize(receiveBufferSize); } catch (SocketException e) { throw new ChannelException(e); } return this; }
@Override public DatagramChannelConfig setReceiveBufferSize(int receiveBufferSize) { try { javaSocket.setReceiveBufferSize(receiveBufferSize); } catch (SocketException e) { throw new ChannelException(e); } return this; }
@Override public DatagramChannelConfig setReceiveBufferSize(int receiveBufferSize) { try { javaSocket.setReceiveBufferSize(receiveBufferSize); } catch (SocketException e) { throw new ChannelException(e); } return this; }
@Override public DatagramChannelConfig setReceiveBufferSize(int receiveBufferSize) { try { javaSocket.setReceiveBufferSize(receiveBufferSize); } catch (SocketException e) { throw new ChannelException(e); } return this; }
@Override public DatagramChannelConfig setReceiveBufferSize(int receiveBufferSize) { try { javaSocket.setReceiveBufferSize(receiveBufferSize); } catch (SocketException e) { throw new ChannelException(e); } return this; }
public DatagramInputStream(int port) throws SocketException { this.port = port; resettableByteArrayInputStream = new ResettableByteArrayInputStream(); datagramSocketToListenOn = new DatagramSocket(port); datagramSocketToListenOn.setReceiveBufferSize(BUFFER_SIZE); int actualBufferSize = datagramSocketToListenOn.getReceiveBufferSize(); if (VERBOSE) System.out.println("DatagramInputStream actualBufferSize = " + actualBufferSize); }
public void setReceiveBufferSize(DatagramSocket ds) throws SocketException { int size = ds.getReceiveBufferSize(); if (receiveBufferSize == 0) { receiveBufferSize = size; } else if (receiveBufferSize != size) { ds.setReceiveBufferSize(receiveBufferSize); receiveBufferSize = ds.getReceiveBufferSize(); } }
protected NetServerIn(String name, Logger logmon) throws IOException { super(name + ".NetServerIn", logmon); socket = new DatagramSocket(port); socket.setReceiveBufferSize(AgentServer.getInteger("UDPReceiveBufferSize", 1048576).intValue()); socket.setSendBufferSize(AgentServer.getInteger("UDPSendBufferSize", 8192).intValue()); if (logmon.isLoggable(BasicLevel.DEBUG)) { logmon.log(BasicLevel.DEBUG, this.getName() + ", socket buffer sizes: Receive:" + socket.getReceiveBufferSize() + " Send:" + socket.getSendBufferSize()); } socketReceiveBufferSize = socket.getReceiveBufferSize(); socketSendBufferSize = socket.getSendBufferSize(); }
private void configureDatagraChannel() throws IOException { datagramChannel.configureBlocking(false); datagramChannel.socket().setSendBufferSize(getUdpTxBufSize()); datagramChannel.socket().setReceiveBufferSize(getUdpRxBufSize()); datagramChannel.socket().setReuseAddress(getSoReuseAddress()); datagramChannel.socket().setSoTimeout(getTimeout()); datagramChannel.socket().setTrafficClass(getSoTrafficClass()); }