Top Inners Fields Constructors Methods
org.newsclub.net.unix

pack-priv Class AFUNIXSocketImpl

extends AFSocketImpl<AFUNIXSocketAddress>
Class Inheritance
Known Direct Subclasses
org.newsclub.net.unix.AFUNIXSocketImpl.Lenient
Imports
java.io.FileDescriptor, .IOException, java.net.Socket, .SocketException

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
AFUNIXSocketImpl.Lenient

Changes the behavior to be somewhat lenient with respect to the specification.

Field Summary

Inherited from org.newsclub.net.unix.AFSocketImpl:
ancillaryDataSupport

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
pack-priv final void
pack-priv AFUNIXSocketCredentials
pack-priv final FileDescriptor[]
pack-priv final boolean
pack-priv final void
pack-priv final void
Inherited from org.newsclub.net.unix.AFSocketImpl:
acceptaccept0availablebindbindcloseconnectconnectconnectconnect0createcreateSocketensureAncillaryReceiveBufferSizegetAddressFamilygetAncillaryDataSupportgetAncillaryReceiveBufferSizegetCoregetFDgetFileDescriptorgetImplExtensionsgetInetAddressgetInputStreamgetLocalPort1getLocalSocketAddressgetOptiongetOptiongetOptionDefaultgetOptionLenientgetOutputStreamgetRemotePortgetRemoteSocketAddressisBoundisClosedisConnectedlistennewInputStreamnewOutputStreamreadreceivesendsendUrgentDatasetAncillaryReceiveBufferSizesetOptionsetOptionsetOptionDefaultsetOptionLenientsetSocketAddressshutdownshutdownInputshutdownOutputsupportedOptionssupportsUrgentDatatoStringupdatePortswrite

Constructor Detail

AFUNIXSocketImplback to summary
protected AFUNIXSocketImpl(FileDescriptor fdObj)

Method Detail

clearReceivedFileDescriptorsback to summary
pack-priv final void clearReceivedFileDescriptors()
getPeerCredentialsback to summary
pack-priv AFUNIXSocketCredentials getPeerCredentials() throws IOException
getReceivedFileDescriptorsback to summary
pack-priv final FileDescriptor[] getReceivedFileDescriptors()
hasOutboundFileDescriptorsback to summary
pack-priv final boolean hasOutboundFileDescriptors()
receiveFileDescriptorsback to summary
pack-priv final void receiveFileDescriptors(int[] fds) throws IOException
setOutboundFileDescriptorsback to summary
pack-priv final void setOutboundFileDescriptors(FileDescriptor... fdescs) throws IOException
org.newsclub.net.unix back to summary

pack-priv final Class AFUNIXSocketImpl.Lenient

extends AFUNIXSocketImpl
Class Inheritance

Changes the behavior to be somewhat lenient with respect to the specification. In particular, we ignore calls to Socket#getTcpNoDelay() and Socket#setTcpNoDelay(boolean).

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Object
getOption(int
an int identifying the option to fetch
optID
)

Overrides org.newsclub.net.unix.AFSocketImpl.getOption.

Implements java.net.SocketOptions.getOption.

Fetch the value of an option.

public void
setOption(int
identifies the option
optID
,
Object
the parameter of the socket option
value
)

Overrides org.newsclub.net.unix.AFSocketImpl.setOption.

Implements java.net.SocketOptions.setOption.

Enable/disable the option specified by optID.

Inherited from org.newsclub.net.unix.AFUNIXSocketImpl:
clearReceivedFileDescriptorsgetPeerCredentialsgetReceivedFileDescriptorshasOutboundFileDescriptorsreceiveFileDescriptorssetOutboundFileDescriptors

Constructor Detail

Lenientback to summary
pack-priv Lenient(FileDescriptor fdObj) throws SocketException

Method Detail

getOptionback to summary
public Object getOption(int optID) throws SocketException

Overrides org.newsclub.net.unix.AFSocketImpl.getOption.

Implements java.net.SocketOptions.getOption.

Doc from java.net.SocketOptions.getOption.

Fetch the value of an option. Binary options will return Boolean#TRUE if enabled, Boolean#FALSE if disabled, e.g.:

SocketImpl s; ... Boolean noDelay = (Boolean)(s.getOption(TCP_NODELAY)); if (noDelay.booleanValue()) { // true if TCP_NODELAY is enabled... ... }
SocketImpl s;
...
Boolean noDelay = (Boolean)(s.getOption(TCP_NODELAY));
if (noDelay.booleanValue()) {
    // true if TCP_NODELAY is enabled...
...
}

For options that take a particular type as a parameter, this method will return the parameter's value, else it will return Boolean#FALSE:

Object o = s.getOption(SO_LINGER); if (o instanceof Integer) { System.out.print("Linger time is " + ((Integer)o).intValue()); } else { // the true type of o is java.lang.Boolean.FALSE; }
Object o = s.getOption(SO_LINGER);
if (o instanceof Integer) {
    System.out.print("Linger time is " + ((Integer)o).intValue());
} else {
  // the true type of o is java.lang.Boolean.FALSE;
}
Parameters
optID:int

an int identifying the option to fetch

Returns:Object

the value of the option

Annotations
@Override
Exceptions
SocketException:
if the socket is closed or if optID is unknown along the protocol stack
setOptionback to summary
public void setOption(int optID, Object value) throws SocketException

Overrides org.newsclub.net.unix.AFSocketImpl.setOption.

Implements java.net.SocketOptions.setOption.

Doc from java.net.SocketOptions.setOption.

Enable/disable the option specified by optID. If the option is to be enabled, and it takes an option-specific "value", this is passed in value. The actual type of value is option-specific, and it is an error to pass something that isn't of the expected type:

SocketImpl s; ... s.setOption(SO_LINGER, Integer.valueOf(10)); // OK - set SO_LINGER w/ timeout of 10 sec. s.setOption(SO_LINGER, Double.valueOf(10)); // ERROR - expects java.lang.Integer
SocketImpl s;
...
s.setOption(SO_LINGER, Integer.valueOf(10));
   // OK - set SO_LINGER w/ timeout of 10 sec.
s.setOption(SO_LINGER, Double.valueOf(10));
   // ERROR - expects java.lang.Integer
If the requested option is binary, it can be set using this method by a Boolean:
s.setOption(TCP_NODELAY, Boolean.TRUE); // OK - enables TCP_NODELAY, a binary option
s.setOption(TCP_NODELAY, Boolean.TRUE);
   // OK - enables TCP_NODELAY, a binary option
Any option can be disabled using this method with a Boolean#FALSE:
s.setOption(TCP_NODELAY, Boolean.FALSE); // OK - disables TCP_NODELAY s.setOption(SO_LINGER, Boolean.FALSE); // OK - disables SO_LINGER
s.setOption(TCP_NODELAY, Boolean.FALSE);
   // OK - disables TCP_NODELAY
s.setOption(SO_LINGER, Boolean.FALSE);
   // OK - disables SO_LINGER
For an option that has a notion of on and off, and requires a non-boolean parameter, setting its value to anything other than Boolean#FALSE implicitly enables it.
Parameters
optID:int

identifies the option

value:Object

the parameter of the socket option

Annotations
@Override
Exceptions
SocketException:
if the option is unrecognized, the socket is closed, or some low-level error occurred