Here you can find the source of tune_tcp_socket(SocketChannel ch)
public static void tune_tcp_socket(SocketChannel ch) throws SocketException
//package com.java2s; /*//from ww w . j av a 2s. c o m Copyright other contributors as noted in the AUTHORS file. This file is part of 0MQ. 0MQ is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 0MQ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ import java.net.Socket; import java.net.SocketException; import java.nio.channels.SocketChannel; public class Main { public static void tune_tcp_socket(SocketChannel ch) throws SocketException { tune_tcp_socket(ch.socket()); } public static void tune_tcp_socket(Socket fd) throws SocketException { // Disable Nagle's algorithm. We are doing data batching on 0MQ level, // so using Nagle wouldn't improve throughput in anyway, but it would // hurt latency. try { fd.setTcpNoDelay(true); } catch (SocketException e) { } } }