JXTA

net.jxta.socket
Class JxtaSocket

java.lang.Object
  extended by java.net.Socket
      extended by net.jxta.socket.JxtaSocket
All Implemented Interfaces:
EventListener, OutputPipeListener, PipeMsgListener

public class JxtaSocket
extends Socket
implements PipeMsgListener, OutputPipeListener

JxtaSocket is a sub-class of java.net.socket, and should be used like a java.net.Socket. Key differences to keep in mind are the following :

- JxtaSocket does not implement Nagle's algorithm, therefore at end of a data frame a flush must invoked to enure all buffered data is packaged and transmitted. - JxtaSocket does not implement keep-alive, therefore it is possible the underlaying messengers to be closed due to lack of inactivity, which manifests in a short latency, while the messenger are recreated. This limitation should cease to exist as soon the inactivity logic is removed.


Field Summary
protected  boolean bound
          If true then we believer our end of the connection is open.
protected  boolean closed
          If true then this socket has been closed and can no longer be used.
protected  Object closeLock
          Lock for closing states.
protected  boolean connected
          If true then we believe the remote peer currently has this socket open.
protected  OutputPipe connectOutpipe
          Used to negotiate connection parameters
protected  PeerGroup group
          The PeerGroup
protected  boolean isReliable
          If true then the socket is a stream socket otherwise it is a datagram socket.
protected  Credential localCredential
          Our credential that we provide to the remote peer.
protected  PipeAdvertisement localEphemeralPipeAdv
          Pipe Advertisement of local ephemeral pipe.
protected  InputPipe localEphemeralPipeIn
          The input pipe for our ephemeral pipe.
protected  int maxRetryTimeout
          maximum retry timeout allowed
protected  net.jxta.socket.JxtaSocketInputStream nonReliableInputStream
          The unreliable input stream we use for receiving data if isReliable is false.
protected  net.jxta.socket.JxtaSocketOutputStream nonReliableOutputStream
          The unreliable output stream we use for sending data if isReliable is false.
protected  Outgoing outgoing
          Used for sending all messages by the reliable output and input streams.
protected  PipeAdvertisement pipeAdv
          Pipe Advertisement of the well known pipe.
protected  Object pipeResolveLock
          Lock for output pipe resolution.
protected  PipeService pipeSvc
           
protected  Credential remoteCredential
          Credential of the remote peer.
protected  PipeAdvertisement remoteEphemeralPipeAdv
          Pipe Advertisement of it's ephemeral pipe.
protected  Messenger remoteEphemeralPipeMsgr
          The Messenger we use to
protected  PeerID remotePeerID
          The peer id of the peer we are connecting to or null if we are willing to connect to any peer.
protected  int retryTimeout
          retry timeout in millisecods
protected  ReliableInputStream ris
          The reliable input stream we use for receiving data if isReliable is true.
protected  ReliableOutputStream ros
          The reliable output stream we use for sending data if isReliable is true.
protected  Object socketConnectLock
          Lock for ephemeral pipe connect states.
protected  long timeout
          timeout for connect and close
protected  int windowSize
          retry window size
 
Constructor Summary
  JxtaSocket()
          This constructor does not establish a connection.
  JxtaSocket(PeerGroup group, PeerID peerid, PipeAdvertisement pipeAdv, int timeout)
          Create a JxtaSocket to any peer listening on pipeAdv this attempts establish a connection to specified pipe within a context of group and within the timeout specified in milliseconds
  JxtaSocket(PeerGroup group, PeerID peerid, PipeAdvertisement pipeAdv, int timeout, boolean reliable)
          Create a JxtaSocket to any peer listening on pipeAdv this attempts establish a connection to specified pipe within a context of group and within the timeout specified in milliseconds
  JxtaSocket(PeerGroup group, PipeAdvertisement pipeAdv)
          Create a JxtaSocket to any node listening on pipeAdv
  JxtaSocket(PeerGroup group, PipeAdvertisement pipeAdv, int timeout)
          Create a JxtaSocket to any peer listening on pipeAdv this attempts establish a connection to specified pipe within the context of the specified group within timeout specified in milliseconds.
protected JxtaSocket(PeerGroup group, PipeAdvertisement pipeAdv, PipeAdvertisement remoteEphemeralPipeAdv, PeerAdvertisement remotePeerAdv, Credential localCredential, Credential remoteCredential, boolean isReliable)
          This constructor is used by JxtaServer socket for creating JxtaSocket instances in response to incoming connections.
  JxtaSocket(SocketAddress address)
          Create a JxtaSocket connected to the give JxtaSocketAddress.
  JxtaSocket(SocketAddress address, int timeout)
          Create a JxtaSocket to the given JxtaSocketAddress, within the timeout specified in milliseconds.
  JxtaSocket(SocketAddress address, int timeout, boolean reliable)
          Create a JxtaSocket to the given JxtaSocketAddress, within the timeout specified in milliseconds.
 
Method Summary
 void bind(SocketAddress address)
          

Unsupported operation, an IOException will be thrown.

 void close()
          

We hard-close both the input and output streams.

protected  void closeFromRemote()
          This is called when closure is initiated on the remote side.
 void connect(PeerGroup group, PeerID peerid, PipeAdvertisement pipeAdv, int timeout)
          Connects to a JxtaServerSocket on a specific peer within a timeout specified in milliseconds
 void connect(PeerGroup group, PipeAdvertisement pipeAdv)
          Connects to a JxtaServerSocket on any peer within the default timeout of 60 seconds
 void connect(PeerGroup group, PipeAdvertisement pipeAdv, int timeout)
          Connects to a JxtaServerSocket on any peer within a timeout specified in milliseconds
 void connect(SocketAddress address)
          

The default connect timeout of 60 seconds is used If SocketAddress is not an instance of JxtaSocketAddress, an IOException will be thrown.

 void connect(SocketAddress address, int timeout)
          

If SocketAddress is not an instance of JxtaSocketAddress, an IOException will be thrown.

 void create(boolean reliable)
          Deprecated. Unreliable mode is being removed. Use JxtaBiDiPipe instead.
protected  Message createConnectMessage(PeerGroup group, PipeAdvertisement pipeAdv, Credential credential, boolean isReliable, boolean initiator)
          Create a connection request/response message
protected  void finalize()
          
 Credential getCredentialDoc()
          get the remote credential doc
protected static Credential getDefaultCredential(PeerGroup group)
          obtain the cred doc from the group object
 InputStream getInputStream()
          
 boolean getKeepAlive()
          
 SocketAddress getLocalSocketAddress()
          
 int getMaxRetryTimeout()
          Deprecated. The reliability layer manages it's own maximum. This value is not useful.
 OutputStream getOutputStream()
          
 int getOutputStreamBufferSize()
          Deprecated. Use the standard getSendBufferSize() method instead.
 int getReceiveBufferSize()
          
 SocketAddress getRemoteSocketAddress()
          
 int getRetryTimeout()
          Gets the Retry Timeout of the reliability layer
 int getSendBufferSize()
          
 int getSoTimeout()
          
 int getTrafficClass()
          
 int getWindowSize()
          When in reliable mode, gets the Reliable library window size
 boolean isBound()
          
 boolean isClosed()
          Returns the closed state of the JxtaSocket.
 boolean isConnected()
          
 boolean isInputShutdown()
          
 boolean isOutputShutdown()
          
protected static Messenger lightweightOutputPipe(PeerGroup group, PipeAdvertisement pipeAdv, PeerAdvertisement peerAdv)
          A lightweight output pipe constructor, note the return type Since all the info needed is available, there's no need for to use the pipe service to resolve the pipe we have all we need to construct a messenger.
protected  Outgoing makeOutgoing(Messenger msgr, long timeout)
          Create an appropriate Outgoing Adaptor.
protected static PipeAdvertisement newEphemeralPipeAdv(PipeAdvertisement pipeAdv)
          Create a pipe advertisement for an ephemeral pipe (w/random pipe ID) from an existing pipe advertisement.
 void outputPipeEvent(OutputPipeEvent event)
          Called when a input pipe has been located for a previously registered pipe.
 void pipeMsgEvent(PipeMsgEvent event)
          Called for each pipe message event that occurs.
 void sendUrgentData(int data)
          
 void setCredential(Credential localCredential)
          Sets our credential to be used by this socket connection.
 void setKeepAlive(boolean state)
          
 void setMaxRetryTimeout(int maxRetryTimeout)
          Deprecated. The reliability layer manages it's own maximum. This value is not useful.
 void setOOBInline(boolean state)
          
 void setOutputStreamBufferSize(int size)
          Deprecated. Use the standard setSendBufferSize(int) method instead.
 void setRetryTimeout(int retryTimeout)
          Sets the Retry Timeout of the underlying reliability layer.
 void setSendBufferSize(int size)
          
 void setSoTimeout(int soTimeout)
          
 void setTrafficClass(int tc)
          
 void setWindowSize(int windowSize)
          When in reliable mode, sets the Reliable library window size
 void shutdownInput()
          
 void shutdownOutput()
          
 String toString()
          

This output is suitable for debugging but should not be parsed.

protected  void unbind()
          Closes the input pipe which we use to receive messages and the messenger used for sending messages.
protected  void write(byte[] buf, int offset, int length)
          Performs on behalf of JxtaSocketOutputStream.
 
Methods inherited from class java.net.Socket
getChannel, getInetAddress, getLocalAddress, getLocalPort, getOOBInline, getPort, getReuseAddress, getSoLinger, getTcpNoDelay, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSocketImplFactory, setSoLinger, setTcpNoDelay
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

group

protected PeerGroup group
The PeerGroup


pipeAdv

protected PipeAdvertisement pipeAdv
Pipe Advertisement of the well known pipe.


localEphemeralPipeAdv

protected PipeAdvertisement localEphemeralPipeAdv
Pipe Advertisement of local ephemeral pipe.


localEphemeralPipeIn

protected InputPipe localEphemeralPipeIn
The input pipe for our ephemeral pipe. We will receive all messages on this pipe.


remoteEphemeralPipeAdv

protected PipeAdvertisement remoteEphemeralPipeAdv
Pipe Advertisement of it's ephemeral pipe.


remoteEphemeralPipeMsgr

protected Messenger remoteEphemeralPipeMsgr
The Messenger we use to


pipeSvc

protected PipeService pipeSvc

remotePeerID

protected PeerID remotePeerID
The peer id of the peer we are connecting to or null if we are willing to connect to any peer.


connectOutpipe

protected OutputPipe connectOutpipe
Used to negotiate connection parameters


timeout

protected long timeout
timeout for connect and close


retryTimeout

protected int retryTimeout
retry timeout in millisecods


maxRetryTimeout

protected int maxRetryTimeout
maximum retry timeout allowed


windowSize

protected int windowSize
retry window size


pipeResolveLock

protected final Object pipeResolveLock
Lock for output pipe resolution.


socketConnectLock

protected final Object socketConnectLock
Lock for ephemeral pipe connect states.


closeLock

protected final Object closeLock
Lock for closing states.


closed

protected volatile boolean closed
If true then this socket has been closed and can no longer be used.


bound

protected boolean bound
If true then we believer our end of the connection is open.


connected

protected boolean connected
If true then we believe the remote peer currently has this socket open.


remoteCredential

protected Credential remoteCredential
Credential of the remote peer.


localCredential

protected Credential localCredential
Our credential that we provide to the remote peer.


isReliable

protected boolean isReliable
If true then the socket is a stream socket otherwise it is a datagram socket.


outgoing

protected Outgoing outgoing
Used for sending all messages by the reliable output and input streams.


ris

protected ReliableInputStream ris
The reliable input stream we use for receiving data if isReliable is true.


ros

protected ReliableOutputStream ros
The reliable output stream we use for sending data if isReliable is true.


nonReliableInputStream

protected net.jxta.socket.JxtaSocketInputStream nonReliableInputStream
The unreliable input stream we use for receiving data if isReliable is false.


nonReliableOutputStream

protected net.jxta.socket.JxtaSocketOutputStream nonReliableOutputStream
The unreliable output stream we use for sending data if isReliable is false.

Constructor Detail

JxtaSocket

public JxtaSocket()
This constructor does not establish a connection. Use this constructor when altering the default parameters, and options of the socket.

By default connections are reliable, and the default timeout is 60 seconds. To alter a connection a call to create(false) changes the connection to an unreliable one.


JxtaSocket

protected JxtaSocket(PeerGroup group,
                     PipeAdvertisement pipeAdv,
                     PipeAdvertisement remoteEphemeralPipeAdv,
                     PeerAdvertisement remotePeerAdv,
                     Credential localCredential,
                     Credential remoteCredential,
                     boolean isReliable)
              throws IOException
This constructor is used by JxtaServer socket for creating JxtaSocket instances in response to incoming connections.

Parameters:
group - group context
pipeAdv - The original PipeAdvertisement
localCredential - Our credential.
remoteEphemeralPipeAdv - the phemeral pipe advertisement
remotePeerAdv - remote peer advertisement
remoteCredential - The remote peer's credential.
isReliable - true for reliable stream connection or false for unreliable stream connection.
Throws:
IOException - if an io error occurs

JxtaSocket

public JxtaSocket(SocketAddress address)
           throws IOException
Create a JxtaSocket connected to the give JxtaSocketAddress.

Parameters:
address - JxtaSocketAddress to connect to
Throws:
IOException - if an io error occurs

JxtaSocket

public JxtaSocket(PeerGroup group,
                  PipeAdvertisement pipeAdv)
           throws IOException
Create a JxtaSocket to any node listening on pipeAdv

Parameters:
group - group context
pipeAdv - PipeAdvertisement
Throws:
IOException - if an io error occurs

JxtaSocket

public JxtaSocket(SocketAddress address,
                  int timeout)
           throws IOException
Create a JxtaSocket to the given JxtaSocketAddress, within the timeout specified in milliseconds.

Parameters:
address - JxtaSocket address to connect to
timeout - The number of milliseconds within which the socket must be successfully created. An exception will be thrown if the socket cannot be created in the allotted time. A timeout value of 0 (zero) specifies an infinite timeout.
Throws:
IOException - For failures in creating the socket.
SocketTimeoutException - If the socket cannot be created before the timeout occurs.

JxtaSocket

public JxtaSocket(PeerGroup group,
                  PipeAdvertisement pipeAdv,
                  int timeout)
           throws IOException
Create a JxtaSocket to any peer listening on pipeAdv this attempts establish a connection to specified pipe within the context of the specified group within timeout specified in milliseconds.

Parameters:
group - group context
pipeAdv - PipeAdvertisement
timeout - The number of milliseconds within which the socket must be successfully created. An exception will be thrown if the socket cannot be created in the allotted time. A timeout value of 0 (zero) specifies an infinite timeout.
Throws:
IOException - if an io error occurs
SocketTimeoutException - If the socket cannot be created before the timeout occurs.

JxtaSocket

public JxtaSocket(PeerGroup group,
                  PeerID peerid,
                  PipeAdvertisement pipeAdv,
                  int timeout)
           throws IOException
Create a JxtaSocket to any peer listening on pipeAdv this attempts establish a connection to specified pipe within a context of group and within the timeout specified in milliseconds

Parameters:
group - group context
peerid - node to connect to
pipeAdv - PipeAdvertisement
timeout - The number of milliseconds within which the socket must be successfully created. An exception will be thrown if the socket cannot be created in the allotted time. A timeout value of 0 (zero) specifies an infinite timeout.
Throws:
IOException - For failures in creating the socket.
SocketTimeoutException - If the socket cannot be created before the timeout occurs.

JxtaSocket

public JxtaSocket(SocketAddress address,
                  int timeout,
                  boolean reliable)
           throws IOException
Create a JxtaSocket to the given JxtaSocketAddress, within the timeout specified in milliseconds. The JxtaSocket can be reliable (stream) or not (datagram). If you want to use a SocketAddress in the constructor, this is the preferred method. Either that, or use JxtaSocket(), followed by create(boolean) to turn on reliability, followed by connect(SocketAddress, int) or connect(SocketAddress) to make the connection.

Parameters:
address - JxtaSocket address to connect to
timeout - The number of milliseconds within which the socket must be successfully created. An exception will be thrown if the socket cannot be created in the allotted time. A timeout value of 0 (zero) specifies an infinite timeout.
reliable - true for reliable stream connection or false for unreliable stream connection.
Throws:
IOException - For failures in creating the socket.
SocketTimeoutException - If the socket cannot be created before the timeout occurs.

JxtaSocket

public JxtaSocket(PeerGroup group,
                  PeerID peerid,
                  PipeAdvertisement pipeAdv,
                  int timeout,
                  boolean reliable)
           throws IOException
Create a JxtaSocket to any peer listening on pipeAdv this attempts establish a connection to specified pipe within a context of group and within the timeout specified in milliseconds

Parameters:
group - group context
peerid - node to connect to
pipeAdv - PipeAdvertisement
timeout - The number of milliseconds within which the socket must be successfully created. An exception will be thrown if the socket cannot be created in the allotted time. A timeout value of 0 (zero) specifies an infinite timeout.
reliable - true for reliable stream connection or false for unreliable stream connection.
Throws:
IOException - For failures in creating the socket.
SocketTimeoutException - If the socket cannot be created before the timeout occurs.
Method Detail

finalize

protected void finalize()
                 throws Throwable

Overrides:
finalize in class Object
Throws:
Throwable

create

@Deprecated
public void create(boolean reliable)
            throws IOException
Deprecated. Unreliable mode is being removed. Use JxtaBiDiPipe instead.

Creates either a stream or a datagram socket.

Parameters:
reliable - true for reliable stream connection or false for unreliable stream connection.
Throws:
IOException - if an I/O error occurs while creating the socket.

bind

public void bind(SocketAddress address)
          throws IOException

Unsupported operation, an IOException will be thrown.

Overrides:
bind in class Socket
Throws:
IOException - Thrown in all cases as this operation is not supported.

connect

public void connect(SocketAddress address)
             throws IOException

The default connect timeout of 60 seconds is used If SocketAddress is not an instance of JxtaSocketAddress, an IOException will be thrown.

Overrides:
connect in class Socket
Throws:
IOException

connect

public void connect(SocketAddress address,
                    int timeout)
             throws IOException

If SocketAddress is not an instance of JxtaSocketAddress, an IOException will be thrown.

Overrides:
connect in class Socket
Throws:
IOException

connect

public void connect(PeerGroup group,
                    PipeAdvertisement pipeAdv)
             throws IOException
Connects to a JxtaServerSocket on any peer within the default timeout of 60 seconds

Parameters:
group - group context
pipeAdv - PipeAdvertisement
Throws:
IOException - if an io error occurs

connect

public void connect(PeerGroup group,
                    PipeAdvertisement pipeAdv,
                    int timeout)
             throws IOException
Connects to a JxtaServerSocket on any peer within a timeout specified in milliseconds

Parameters:
group - group context
pipeAdv - PipeAdvertisement
timeout - in milliseconds
Throws:
IOException - if an io error occurs

connect

public void connect(PeerGroup group,
                    PeerID peerid,
                    PipeAdvertisement pipeAdv,
                    int timeout)
             throws IOException
Connects to a JxtaServerSocket on a specific peer within a timeout specified in milliseconds

Parameters:
group - group context
peerid - peer to connect to
pipeAdv - PipeAdvertisement
timeout - timeout in milliseconds
Throws:
IOException - if an io error occurs

getDefaultCredential

protected static Credential getDefaultCredential(PeerGroup group)
obtain the cred doc from the group object

Parameters:
group - the group context
Returns:
The Credential value

getCredentialDoc

public Credential getCredentialDoc()
get the remote credential doc

Returns:
Credential StructuredDocument

setCredential

public void setCredential(Credential localCredential)
Sets our credential to be used by this socket connection. If no credentials are set, the default group credential will be used.

Parameters:
localCredential - The credential to be used for connection responses or null if the default credential is to be used.

createConnectMessage

protected Message createConnectMessage(PeerGroup group,
                                       PipeAdvertisement pipeAdv,
                                       Credential credential,
                                       boolean isReliable,
                                       boolean initiator)
                                throws IOException
Create a connection request/response message

Parameters:
group - The group in which the socket is being used.
pipeAdv - Advertisement for our ephemeral pipe.
credential - Our credential or null if default credential is to be used.
isReliable - The socket is to be reliable (stream).
initiator - indicates initiator
Returns:
The message.
Throws:
IOException - if an I/O error occurs

newEphemeralPipeAdv

protected static PipeAdvertisement newEphemeralPipeAdv(PipeAdvertisement pipeAdv)
Create a pipe advertisement for an ephemeral pipe (w/random pipe ID) from an existing pipe advertisement. The specified pipe adveritsement is only used for the name and type

Parameters:
pipeAdv - to get the basename and type from
Returns:
A new pipe advertisement for an ephemeral pipe.

isBound

public boolean isBound()

Overrides:
isBound in class Socket

isConnected

public boolean isConnected()

Overrides:
isConnected in class Socket

makeOutgoing

protected Outgoing makeOutgoing(Messenger msgr,
                                long timeout)
Create an appropriate Outgoing Adaptor. This method exists primarily so that sub-classes can substitute a different Outgoing sub-class.

Parameters:
msgr - The messenger to be wrapped.
timeout - The timeout value;
Returns:
Outgoing The messenger wrapped in an appropriate adaptor.

getOutputStreamBufferSize

@Deprecated
public int getOutputStreamBufferSize()
Deprecated. Use the standard getSendBufferSize() method instead.

Returns the internal output stream buffer size

Returns:
the internal buffer size.

setOutputStreamBufferSize

@Deprecated
public void setOutputStreamBufferSize(int size)
                               throws IOException
Deprecated. Use the standard setSendBufferSize(int) method instead.

Sets the internal output stream buffer size.

Parameters:
size - The internal buffer size.
Throws:
IOException - if an I/O error occurs

getInputStream

public InputStream getInputStream()
                           throws IOException

Overrides:
getInputStream in class Socket
Throws:
IOException

getOutputStream

public OutputStream getOutputStream()
                             throws IOException

Overrides:
getOutputStream in class Socket
Throws:
IOException

close

public void close()
           throws IOException

We hard-close both the input and output streams. Nothing can be written or read to the socket after this method. Any queued incoming data is discarded. Any additional incoming messages will be ACKed but their content will be discarded. We will attempt to send any data which has already been written to the OutputStream.

Once the output queue is empty we will send a close message to tell the remote side that no more data is coming.

This is the only method in this class which is synchronized. All others use internal synchronization.

Overrides:
close in class Socket
Throws:
IOException

closeFromRemote

protected void closeFromRemote()
                        throws IOException
This is called when closure is initiated on the remote side. By convention we receive the close message only after we have ACKed the last data segment.

We soft-close the InputStream which allows us to read data already received.

We hard-close our output stream and discard all queued, unACKed data as the remote side doesn't want to receive it (the remote side has already unbound themselves, they just want our close ACK in order to clean up.)

Throws:
IOException - if an I/O error occurs

unbind

protected void unbind()
Closes the input pipe which we use to receive messages and the messenger used for sending messages.


pipeMsgEvent

public void pipeMsgEvent(PipeMsgEvent event)
Called for each pipe message event that occurs.

Specified by:
pipeMsgEvent in interface PipeMsgListener
Parameters:
event - The event being received.

outputPipeEvent

public void outputPipeEvent(OutputPipeEvent event)
Called when a input pipe has been located for a previously registered pipe. The event contains an OutputPipe which can be used to communicate with the remote peer.

Specified by:
outputPipeEvent in interface OutputPipeListener
Parameters:
event - the event

lightweightOutputPipe

protected static Messenger lightweightOutputPipe(PeerGroup group,
                                                 PipeAdvertisement pipeAdv,
                                                 PeerAdvertisement peerAdv)
A lightweight output pipe constructor, note the return type Since all the info needed is available, there's no need for to use the pipe service to resolve the pipe we have all we need to construct a messenger.

Parameters:
group - group context
pipeAdv - Remote Pipe Advertisement
peerAdv - Remote Peer Advertisement
Returns:
Messenger

getSoTimeout

public int getSoTimeout()
                 throws SocketException

Overrides:
getSoTimeout in class Socket
Throws:
SocketException

setSoTimeout

public void setSoTimeout(int soTimeout)
                  throws SocketException

Overrides:
setSoTimeout in class Socket
Throws:
SocketException

getMaxRetryTimeout

@Deprecated
public int getMaxRetryTimeout()
Deprecated. The reliability layer manages it's own maximum. This value is not useful.

Gets the Maximum Retry Timeout of the reliability layer

Returns:
The maximum retry Timeout value

setMaxRetryTimeout

@Deprecated
public void setMaxRetryTimeout(int maxRetryTimeout)
Deprecated. The reliability layer manages it's own maximum. This value is not useful.

Gets the Maximum Retry Timeout of the reliability layer

Parameters:
maxRetryTimeout - The new maximum retry timeout value
Throws:
IllegalArgumentException - if maxRetryTimeout exceeds jxta platform maximum retry timeout

getRetryTimeout

public int getRetryTimeout()
Gets the Retry Timeout of the reliability layer

Returns:
The retry Timeout value

setRetryTimeout

public void setRetryTimeout(int retryTimeout)
                     throws SocketException
Sets the Retry Timeout of the underlying reliability layer. In reliable mode it is possible for this call to block trying to obtain a lock on reliable input stream

Parameters:
retryTimeout - The new retry timeout value
Throws:
SocketException - if an I/O error occurs

getWindowSize

public int getWindowSize()
When in reliable mode, gets the Reliable library window size

Returns:
The windowSize value

setWindowSize

public void setWindowSize(int windowSize)
                   throws SocketException
When in reliable mode, sets the Reliable library window size

Parameters:
windowSize - The new window size value
Throws:
SocketException - if an I/O error occurs

isClosed

public boolean isClosed()
Returns the closed state of the JxtaSocket.

Overrides:
isClosed in class Socket
Returns:
true if the socket has been closed

write

protected void write(byte[] buf,
                     int offset,
                     int length)
              throws IOException
Performs on behalf of JxtaSocketOutputStream.

Parameters:
buf - the data.
offset - the start offset in the data.
length - the number of bytes to write.
Throws:
IOException - if an I/O error occurs
See Also:
OutputStream.write(int)

getSendBufferSize

public int getSendBufferSize()
                      throws SocketException

Overrides:
getSendBufferSize in class Socket
Throws:
SocketException

setSendBufferSize

public void setSendBufferSize(int size)
                       throws SocketException

Overrides:
setSendBufferSize in class Socket
Throws:
SocketException

getReceiveBufferSize

public int getReceiveBufferSize()
                         throws SocketException

Overrides:
getReceiveBufferSize in class Socket
Throws:
SocketException

getKeepAlive

public boolean getKeepAlive()
                     throws SocketException

Overrides:
getKeepAlive in class Socket
Throws:
SocketException

getTrafficClass

public int getTrafficClass()
                    throws SocketException

Overrides:
getTrafficClass in class Socket
Throws:
SocketException

setTrafficClass

public void setTrafficClass(int tc)
                     throws SocketException

Overrides:
setTrafficClass in class Socket
Throws:
SocketException

isInputShutdown

public boolean isInputShutdown()

Overrides:
isInputShutdown in class Socket

isOutputShutdown

public boolean isOutputShutdown()

Overrides:
isOutputShutdown in class Socket

sendUrgentData

public void sendUrgentData(int data)
                    throws IOException

Overrides:
sendUrgentData in class Socket
Throws:
IOException

setOOBInline

public void setOOBInline(boolean state)
                  throws SocketException

Overrides:
setOOBInline in class Socket
Throws:
SocketException

setKeepAlive

public void setKeepAlive(boolean state)
                  throws SocketException

Overrides:
setKeepAlive in class Socket
Throws:
SocketException

shutdownInput

public void shutdownInput()
                   throws IOException

Overrides:
shutdownInput in class Socket
Throws:
IOException

shutdownOutput

public void shutdownOutput()
                    throws IOException

Overrides:
shutdownOutput in class Socket
Throws:
IOException

getLocalSocketAddress

public SocketAddress getLocalSocketAddress()

Overrides:
getLocalSocketAddress in class Socket

getRemoteSocketAddress

public SocketAddress getRemoteSocketAddress()

Overrides:
getRemoteSocketAddress in class Socket

toString

public String toString()

This output is suitable for debugging but should not be parsed. All of the information is available through other means.

Overrides:
toString in class Socket

JXSE