new option: tcpNoDelay (#85985#)
This commit is contained in:
parent
376c65afb1
commit
8d67e7ebb0
2 changed files with 21 additions and 11 deletions
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: SocketConnection.java,v $
|
||||
*
|
||||
* $Revision: 1.3 $
|
||||
* $Revision: 1.4 $
|
||||
*
|
||||
* last change: $Author: kr $ $Date: 2000-11-28 11:17:52 $
|
||||
* last change: $Author: kr $ $Date: 2001-04-17 09:52:17 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -83,7 +83,7 @@ import com.sun.star.connection.XConnectionBroadcaster;
|
|||
* and is uses by the <code>SocketConnector</code> and the <code>SocketAcceptor</code>.
|
||||
* This class is not part of the provided <code>api</code>.
|
||||
* <p>
|
||||
* @version $Revision: 1.3 $ $ $Date: 2000-11-28 11:17:52 $
|
||||
* @version $Revision: 1.4 $ $ $Date: 2001-04-17 09:52:17 $
|
||||
* @author Kay Ramme
|
||||
* @see com.sun.star.comp.connections.SocketAcceptor
|
||||
* @see com.sun.star.comp.connections.SocketConnector
|
||||
|
@ -119,7 +119,6 @@ public class SocketConnection implements XConnection, XConnectionBroadcaster {
|
|||
+ ",peerPort=" + socket.getPort();
|
||||
|
||||
_socket = socket;
|
||||
_socket.setTcpNoDelay(true);
|
||||
_inputStream = new BufferedInputStream(socket.getInputStream());
|
||||
_outputStream = new BufferedOutputStream(socket.getOutputStream());
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: socketConnector.java,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: kr $ $Date: 2000-11-28 11:17:52 $
|
||||
* last change: $Author: kr $ $Date: 2001-04-17 09:52:17 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -87,7 +87,7 @@ import com.sun.star.registry.XRegistryKey;
|
|||
* <code>sockets</code> for communication.
|
||||
* The socketConnector is in general used by the Connector service.
|
||||
* <p>
|
||||
* @version $Revision: 1.2 $ $ $Date: 2000-11-28 11:17:52 $
|
||||
* @version $Revision: 1.3 $ $ $Date: 2001-04-17 09:52:17 $
|
||||
* @author Kay Ramme
|
||||
* @see com.sun.star.connections.XAcceptor
|
||||
* @see com.sun.star.connections.XConnector
|
||||
|
@ -145,9 +145,10 @@ public class socketConnector implements XConnector {
|
|||
|
||||
|
||||
|
||||
protected String _description;
|
||||
protected String _hostname = "0";
|
||||
protected int _port = 6001;
|
||||
protected String _description;
|
||||
protected String _hostname = "0";
|
||||
protected int _port = 6001;
|
||||
protected Boolean _tcpNoDelay = null;
|
||||
|
||||
/**
|
||||
* Connect through the described mechanism to a waiting server.
|
||||
|
@ -206,13 +207,18 @@ public class socketConnector implements XConnector {
|
|||
}
|
||||
|
||||
index = word.indexOf('=');
|
||||
String left = word.substring(0, index).trim();
|
||||
String left = word.substring(0, index).trim().toLowerCase();
|
||||
String right = word.substring(index + 1).trim();
|
||||
|
||||
if(left.equals("host"))
|
||||
_hostname = right;
|
||||
|
||||
else if(left.equals("port"))
|
||||
_port = Integer.parseInt(right);
|
||||
|
||||
else if(left.equals("tcpnodelay"))
|
||||
_tcpNoDelay = new Boolean(Integer.parseInt(right) == 1);
|
||||
|
||||
else
|
||||
System.err.println(getClass().getName() + ".connect - unknown attribute:" + left);
|
||||
}
|
||||
|
@ -224,6 +230,11 @@ public class socketConnector implements XConnector {
|
|||
InetAddress inetAddress = InetAddress.getByName(_hostname);
|
||||
Socket socket = new Socket(inetAddress, _port);
|
||||
|
||||
if(_tcpNoDelay != null) { // trilogic: did the user specify something about nagle?
|
||||
if (DEBUG) System.err.println("##### " + getClass().getName() + ".connect - setting tcpNoDelay with " + _tcpNoDelay.booleanValue());
|
||||
socket.setTcpNoDelay(_tcpNoDelay.booleanValue());
|
||||
}
|
||||
|
||||
xConnection = new SocketConnection(description, socket);
|
||||
}
|
||||
catch(UnknownHostException unknownHostException) {
|
||||
|
|
Loading…
Reference in a new issue