|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.net.Socket
com.ibm.di.api.remote.impl.rmi.SocketWrapper
public class SocketWrapper
A wrapper class of Socket class for use by the RMI. Socket class implements client sockets. A socket is an endpoint for communication between two machines.
Constructor Summary | |
---|---|
SocketWrapper(java.net.Socket aSocket)
Creates SocketWrapper by given Socket . |
Method Summary | |
---|---|
void |
bind(java.net.SocketAddress aBindpoint)
Binds the socket to a local address. |
void |
close()
Closes this socket. |
void |
connect(java.net.SocketAddress aEndpoint)
Connects this socket to the server. |
void |
connect(java.net.SocketAddress aEndpoint,
int aTimeout)
Connects this socket to the server with a specified timeout value. |
java.nio.channels.SocketChannel |
getChannel()
Returns the unique SocketChannel object associated with this socket, if any. |
java.net.InetAddress |
getInetAddress()
Returns the address to which the socket is connected. |
java.io.InputStream |
getInputStream()
Returns an InputStreamWrapper for this socket. |
boolean |
getKeepAlive()
Tests if SO_KEEPALIVE is enabled. |
java.net.InetAddress |
getLocalAddress()
Gets the local address to which the socket is bound. |
int |
getLocalPort()
Returns the local port to which this socket is bound. |
java.net.SocketAddress |
getLocalSocketAddress()
Returns the address of the endpoint this socket is bound to, or null if it is not bound yet |
boolean |
getOOBInline()
Tests if OOBINLINE is enabled. |
java.io.OutputStream |
getOutputStream()
Returns an output stream for this socket. |
int |
getPort()
Returns the remote port to which this socket is connected. |
int |
getReceiveBufferSize()
Gets the value of the SO_RCVBUF option for this Socket, that is the buffer size used by the platform for input on this Socket. |
java.net.SocketAddress |
getRemoteSocketAddress()
Returns the address of the endpoint this socket is connected to, or null if it is unconnected. |
boolean |
getReuseAddress()
Tests if SO_REUSEADDR is enabled. |
int |
getSendBufferSize()
Get value of the SO_SNDBUF option for this Socket, that is the buffer size used by the platform for output on this Socket. |
int |
getSoLinger()
Returns setting for SO_LINGER. |
int |
getSoTimeout()
Returns setting for SO_TIMEOUT. |
boolean |
getTcpNoDelay()
Tests if TCP_NODELAY is enabled. |
int |
getTrafficClass()
Gets traffic class or type-of-service in the IP header for packets sent from this Socket |
boolean |
isBound()
Returns the binding state of the socket. |
boolean |
isClosed()
Returns the closed state of the socket. |
boolean |
isConnected()
Returns the connection state of the socket. |
boolean |
isInputShutdown()
Returns whether the read-half of the socket connection is closed. |
boolean |
isOutputShutdown()
Returns whether the write-half of the socket connection is closed. |
void |
sendUrgentData(int aData)
Send one byte of urgent data on the socket. |
void |
setKeepAlive(boolean aOn)
Enable/disable SO_KEEPALIVE. |
void |
setOOBInline(boolean aOn)
Enable/disable OOBINLINE (receipt of TCP urgent data) By default, this option is disabled and TCP urgent data received on a socket is silently discarded. |
void |
setReceiveBufferSize(int aSize)
Sets the SO_RCVBUF option to the specified value for this Socket. |
void |
setReuseAddress(boolean aOn)
Enable/disable the SO_REUSEADDR socket option. |
void |
setSendBufferSize(int aSize)
Sets the SO_SNDBUF option to the specified value for this Socket. |
void |
setSoLinger(boolean aOn,
int aLinger)
Enable/disable SO_LINGER with the specified linger time in seconds. |
void |
setSoTimeout(int aTimeout)
Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds. |
void |
setTcpNoDelay(boolean aOn)
Enable/disable TCP_NODELAY (disable/enable Nagle's algorithm). |
void |
setTrafficClass(int aTc)
Sets traffic class or type-of-service octet in the IP header for packets sent from this Socket. |
void |
shutdownInput()
Places the input stream for this socket at "end of stream". |
void |
shutdownOutput()
Disables the output stream for this socket. |
java.lang.String |
toString()
Converts this socket to a String. |
Methods inherited from class java.net.Socket |
---|
setPerformancePreferences, setSocketImplFactory |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SocketWrapper(java.net.Socket aSocket)
Socket
.
aSocket
- Socket
objectMethod Detail |
---|
public void connect(java.net.SocketAddress aEndpoint) throws java.io.IOException
connect
in class java.net.Socket
aEndpoint
- the SocketAddress
java.io.IOException
- if an error occurs during the connectionpublic void connect(java.net.SocketAddress aEndpoint, int aTimeout) throws java.io.IOException
connect
in class java.net.Socket
aEndpoint
- the SocketAddress
aTimeout
- the timeout value to be used in milliseconds.
java.io.IOException
- if an error occurs during the connectionpublic void bind(java.net.SocketAddress aBindpoint) throws java.io.IOException
If the address is null, then the system will pick up an ephemeral port and a valid local address to bind the socket.
bind
in class java.net.Socket
aBindpoint
- the SocketAddress
to bind to
java.io.IOException
public java.net.InetAddress getInetAddress()
getInetAddress
in class java.net.Socket
null
if the socket is not connected.public java.net.InetAddress getLocalAddress()
getLocalAddress
in class java.net.Socket
InetAddress.anyLocalAddress()
if the socket is not
bound yetpublic int getPort()
getPort
in class java.net.Socket
public int getLocalPort()
getLocalPort
in class java.net.Socket
public java.net.SocketAddress getRemoteSocketAddress()
getRemoteSocketAddress
in class java.net.Socket
SocketAddress
reprensenting the remote endpoint
of this socket, or null if it is not connected yetgetInetAddress()
,
connect(SocketAddress)
public java.net.SocketAddress getLocalSocketAddress()
getLocalSocketAddress
in class java.net.Socket
SocketAddress
representing the local endpoint of
this socket, or null if it is not bound yetgetLocalAddress()
,
bind(SocketAddress)
public java.nio.channels.SocketChannel getChannel()
getChannel
in class java.net.Socket
null
if this socket was not created for a channelpublic java.io.InputStream getInputStream() throws java.io.IOException
InputStreamWrapper
for this socket.
getInputStream
in class java.net.Socket
InputStreamWrapper
for reading bytes from this
socket
java.io.IOException
- if an I/O error occurs when creating the input stream, the
socket is closed, the socket is not connected, or the socket
input has been shutdown using shutdownInput()
public java.io.OutputStream getOutputStream() throws java.io.IOException
getOutputStream
in class java.net.Socket
java.io.IOException
- if an I/O error occurs when creating the output stream or if
the socket is not connectedpublic void setTcpNoDelay(boolean aOn) throws java.net.SocketException
setTcpNoDelay
in class java.net.Socket
aOn
- true
to enable TCP_NODELAY, false
to disable.
java.net.SocketException
- if there is an error in the underlying protocol, such as a
TCP error.public boolean getTcpNoDelay() throws java.net.SocketException
getTcpNoDelay
in class java.net.Socket
boolean
indicating whether or not TCP_NODELAY is
enabled.
java.net.SocketException
- if there is an error in the underlying protocol, such as a
TCP error.public void setSoLinger(boolean aOn, int aLinger) throws java.net.SocketException
setSoLinger
in class java.net.Socket
aOn
- whether or not to linger onaLinger
- how long to linger for, if on is true
java.net.SocketException
- if there is an error in the underlying protocol, such as a
TCP errorpublic int getSoLinger() throws java.net.SocketException
getSoLinger
in class java.net.Socket
java.net.SocketException
- if there is an error in the underlying protocol, such as a
TCP errorpublic void sendUrgentData(int aData) throws java.io.IOException
sendUrgentData
in class java.net.Socket
aData
- The byte of data to send
java.io.IOException
- if there is an error sending the data.public void setOOBInline(boolean aOn) throws java.net.SocketException
setOOBInline
in class java.net.Socket
aOn
- true
to enable OOBINLINE, false to disable.
java.net.SocketException
- if there is an error in the underlying protocol, such as a
TCP error.public boolean getOOBInline() throws java.net.SocketException
getOOBInline
in class java.net.Socket
boolean
indicating whether or not OOBINLINE is
enabled.
java.net.SocketException
- if there is an error in the underlying protocol, such as a
TCP error.public void setSoTimeout(int aTimeout) throws java.net.SocketException
setSoTimeout
in class java.net.Socket
aTimeout
- the specified timeout, in milliseconds.
java.net.SocketException
- if there is an error in the underlying protocol, such as a
TCP error.getSoTimeout()
public int getSoTimeout() throws java.net.SocketException
getSoTimeout
in class java.net.Socket
java.net.SocketException
- if there is an error in the underlying protocol, such as a
TCP error.setSoTimeout(int)
public void setSendBufferSize(int aSize) throws java.net.SocketException
setSendBufferSize
in class java.net.Socket
aSize
- the size to which to set the send buffer size. This value must
be greater than 0.
java.net.SocketException
- if there is an error in the underlying protocol, such as a
TCP error.getSendBufferSize()
public int getSendBufferSize() throws java.net.SocketException
getSendBufferSize
in class java.net.Socket
java.net.SocketException
- if there is an error in the underlying protocol, such as a
TCP error.setSendBufferSize(int)
public void setReceiveBufferSize(int aSize) throws java.net.SocketException
setReceiveBufferSize
in class java.net.Socket
aSize
- the size to which to set the receive buffer size. This value
must be greater than 0.
java.net.SocketException
- if there is an error in the underlying protocol, such as a
TCP error.getReceiveBufferSize()
public int getReceiveBufferSize() throws java.net.SocketException
getReceiveBufferSize
in class java.net.Socket
java.net.SocketException
- if there is an error in the underlying protocol, such as a
TCP error.setReceiveBufferSize(int)
public void setKeepAlive(boolean aOn) throws java.net.SocketException
setKeepAlive
in class java.net.Socket
aOn
- whether or not to have socket keep alive turned on.
java.net.SocketException
- if there is an error in the underlying protocol, such as a
TCP error.getKeepAlive()
public boolean getKeepAlive() throws java.net.SocketException
getKeepAlive
in class java.net.Socket
boolean
indicating whether or not SO_KEEPALIVE
is enabled.
java.net.SocketException
- if there is an error in the underlying protocol, such as a
TCP error.setKeepAlive(boolean)
public void setTrafficClass(int aTc) throws java.net.SocketException
setTrafficClass
in class java.net.Socket
aTc
- an int
value for the bitset.
java.net.SocketException
- if there is an error setting the traffic class or
type-of-servicegetTrafficClass()
public int getTrafficClass() throws java.net.SocketException
getTrafficClass
in class java.net.Socket
java.net.SocketException
- if there is an error obtaining the traffic class or
type-of-service value.setTrafficClass(int)
public void setReuseAddress(boolean aOn) throws java.net.SocketException
setReuseAddress
in class java.net.Socket
aOn
- whether to enable or disable the socket option
java.net.SocketException
- if an error occurs enabling or disabling the SO_RESUEADDR
socket option, or the socket is closed.getReuseAddress()
public boolean getReuseAddress() throws java.net.SocketException
getReuseAddress
in class java.net.Socket
boolean
indicating whether or not SO_REUSEADDR
is enabled.
java.net.SocketException
- if there is an error in the underlying protocol, such as a
TCP error.setReuseAddress(boolean)
public void close() throws java.io.IOException
close
in class java.net.Socket
java.io.IOException
- if an I/O error occurs when closing this socket.public void shutdownInput() throws java.io.IOException
shutdownInput
in class java.net.Socket
java.io.IOException
- if an I/O error occurs when shutting down this socket.public void shutdownOutput() throws java.io.IOException
shutdownOutput
in class java.net.Socket
java.io.IOException
- if an I/O error occurs when shutting down this socket.public java.lang.String toString()
toString
in class java.net.Socket
public boolean isConnected()
isConnected
in class java.net.Socket
true
if the socket successfuly connected to a
serverpublic boolean isBound()
isBound
in class java.net.Socket
true
if the socket successfuly bound to an addresspublic boolean isClosed()
isClosed
in class java.net.Socket
true
if the socket has been closedclose()
public boolean isInputShutdown()
isInputShutdown
in class java.net.Socket
true
if the input of the socket has been shutdownshutdownInput()
public boolean isOutputShutdown()
isOutputShutdown
in class java.net.Socket
true
if the output of the socket has been shutdown
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |