- java.lang.Object
-
- swim.io.TcpSettings
-
-
Field Summary
Fields Modifier and Type Field Description protected booleankeepAliveprotected booleannoDelayprotected intreadBufferSizeprotected intreceiveBufferSizeprotected intsendBufferSizeprotected intwriteBufferSize
-
Constructor Summary
Constructors Constructor Description TcpSettings(boolean keepAlive, boolean noDelay, int receiveBufferSize, int sendBufferSize, int readBufferSize, int writeBufferSize)
-
Method Summary
Modifier and Type Method Description booleancanEqual(Object other)Returnstrueif theseTcpSettingscan possibly equal someotherobject.voidconfigure(Socket socket)Configures thesocketwith theseTcpSettings.protected TcpSettingscopy(boolean keepAlive, boolean noDelay, int receiveBufferSize, int sendBufferSize, int readBufferSize, int writeBufferSize)Returns a newTcpSettingsinstance with the given options.voiddebug(Output<?> output)Writes a developer readable, debug-formatted string representation of this object tooutput.booleanequals(Object other)static Form<TcpSettings>form()Returns the structuralFormofTcpSettings.inthashCode()booleankeepAlive()Returnstrueif TCP should be configured with theSO_KEEPALIVEsocket option to send keepalive probes to prevent idle connections from timing out.TcpSettingskeepAlive(boolean keepAlive)Returns a copy of theseTcpSettingsconfigured with the givenkeepAlivevalue for theSO_KEEPALIVEsocket option.booleannoDelay()Returnstrueif TCP should be configured with theTCP_NODELAYsocket option to disable Nagle's algorithm.TcpSettingsnoDelay(boolean noDelay)Returns a copy of theseTcpSettingsconfigured with the givennoDelayvalue for theTCP_NODELAYsocket option.intreadBufferSize()Returns the size in bytes of the per-socket userspace buffers into which data is received.TcpSettingsreadBufferSize(int readBufferSize)Returns a copy of theseTcpSettingsconfigured with the givenreadBufferSizefor per-socket userspace read buffers.intreceiveBufferSize()Returns the value of theSO_RCVBUFsocket option with which TCP should be configured to control the size of receive buffers.TcpSettingsreceiveBufferSize(int receiveBufferSize)Returns a copy of theseTcpSettingsconfigured with the givenreceiveBufferSizevalue for theSO_RCVBUFsocket option.intsendBufferSize()Returns the value of theSO_SNDBUFsocket option with which TCP should be configured to control the size of send buffers.TcpSettingssendBufferSize(int sendBufferSize)Returns a copy of theseTcpSettingsconfigured with the givensendBufferSizevalue for theSO_SNDBUFsocket option.static TcpSettingsstandard()Returns the defaultTcpSettingsinstance.StringtoString()ValuetoValue()Returns a structuralValuerepresenting theseTcpSettings.intwriteBufferSize()Returns the size in bytes of the per-socket userspace buffers from which data is sent.TcpSettingswriteBufferSize(int writeBufferSize)Returns a copy of theseTcpSettingsconfigured with the givenwriteBufferSizefor per-socket userspace write buffers.
-
-
-
Field Detail
-
keepAlive
protected final boolean keepAlive
-
noDelay
protected final boolean noDelay
-
receiveBufferSize
protected final int receiveBufferSize
-
sendBufferSize
protected final int sendBufferSize
-
readBufferSize
protected final int readBufferSize
-
writeBufferSize
protected final int writeBufferSize
-
-
Method Detail
-
standard
public static TcpSettings standard()
Returns the defaultTcpSettingsinstance.
-
form
@Kind public static Form<TcpSettings> form()
Returns the structuralFormofTcpSettings.
-
keepAlive
public final boolean keepAlive()
Returnstrueif TCP should be configured with theSO_KEEPALIVEsocket option to send keepalive probes to prevent idle connections from timing out.
-
keepAlive
public TcpSettings keepAlive(boolean keepAlive)
Returns a copy of theseTcpSettingsconfigured with the givenkeepAlivevalue for theSO_KEEPALIVEsocket option.
-
noDelay
public final boolean noDelay()
Returnstrueif TCP should be configured with theTCP_NODELAYsocket option to disable Nagle's algorithm.
-
noDelay
public TcpSettings noDelay(boolean noDelay)
Returns a copy of theseTcpSettingsconfigured with the givennoDelayvalue for theTCP_NODELAYsocket option.
-
receiveBufferSize
public final int receiveBufferSize()
Returns the value of theSO_RCVBUFsocket option with which TCP should be configured to control the size of receive buffers.
-
receiveBufferSize
public TcpSettings receiveBufferSize(int receiveBufferSize)
Returns a copy of theseTcpSettingsconfigured with the givenreceiveBufferSizevalue for theSO_RCVBUFsocket option.
-
sendBufferSize
public final int sendBufferSize()
Returns the value of theSO_SNDBUFsocket option with which TCP should be configured to control the size of send buffers.
-
sendBufferSize
public TcpSettings sendBufferSize(int sendBufferSize)
Returns a copy of theseTcpSettingsconfigured with the givensendBufferSizevalue for theSO_SNDBUFsocket option.
-
readBufferSize
public final int readBufferSize()
Returns the size in bytes of the per-socket userspace buffers into which data is received.
-
readBufferSize
public TcpSettings readBufferSize(int readBufferSize)
Returns a copy of theseTcpSettingsconfigured with the givenreadBufferSizefor per-socket userspace read buffers.
-
writeBufferSize
public final int writeBufferSize()
Returns the size in bytes of the per-socket userspace buffers from which data is sent.
-
writeBufferSize
public TcpSettings writeBufferSize(int writeBufferSize)
Returns a copy of theseTcpSettingsconfigured with the givenwriteBufferSizefor per-socket userspace write buffers.
-
copy
protected TcpSettings copy(boolean keepAlive, boolean noDelay, int receiveBufferSize, int sendBufferSize, int readBufferSize, int writeBufferSize)
Returns a newTcpSettingsinstance with the given options. Subclasses may override this method to ensure the proper class is instantiated when updating settings.
-
configure
public void configure(Socket socket) throws SocketException
Configures thesocketwith theseTcpSettings.- Throws:
SocketException
-
toValue
public Value toValue()
Returns a structuralValuerepresenting theseTcpSettings.
-
canEqual
public boolean canEqual(Object other)
Returnstrueif theseTcpSettingscan possibly equal someotherobject.
-
debug
public void debug(Output<?> output)
Description copied from interface:DebugWrites a developer readable, debug-formatted string representation of this object tooutput.
-
-