|
|||||||||||
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(Socket aSocket)
Creates SocketWrapper by given Socket . |
Method Summary | |
---|---|
void |
bind(SocketAddress aBindpoint)
Binds the socket to a local address. |
void |
close()
Closes this socket. |
void |
connect(SocketAddress aEndpoint)
Connects this socket to the server. |
void |
connect(SocketAddress aEndpoint,
int aTimeout)
Connects this socket to the server with a specified timeout value. |
SocketChannel |
getChannel()
Returns the unique SocketChannel object associated with this socket, if any. |
InetAddress |
getInetAddress()
Returns the address to which the socket is connected. |
InputStream |
getInputStream()
Returns an InputStreamWrapper for this socket. |
boolean |
getKeepAlive()
Tests if SO_KEEPALIVE is enabled. |
InetAddress |
getLocalAddress()
Gets the local address to which the socket is bound. |
int |
getLocalPort()
Returns the local port to which this socket is bound. |
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. |
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. |
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. |
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(Socket aSocket)
Socket
.
aSocket
- Socket
objectMethod Detail |
---|
public void connect(SocketAddress aEndpoint) throws IOException
connect
in class Socket
aEndpoint
- the SocketAddress
IOException
- if an error occurs during the connectionpublic void connect(SocketAddress aEndpoint, int aTimeout) throws IOException
connect
in class Socket
aEndpoint
- the SocketAddress
aTimeout
- the timeout value to be used in milliseconds.
IOException
- if an error occurs during the connectionpublic void bind(SocketAddress aBindpoint) throws 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 Socket
aBindpoint
- the SocketAddress
to bind to
IOException
public InetAddress getInetAddress()
getInetAddress
in class Socket
null
if the socket is not connected.public InetAddress getLocalAddress()
getLocalAddress
in class Socket
InetAddress.anyLocalAddress()
if the socket is not
bound yetpublic int getPort()
getPort
in class Socket
public int getLocalPort()
getLocalPort
in class Socket
public SocketAddress getRemoteSocketAddress()
getRemoteSocketAddress
in class Socket
SocketAddress
reprensenting the remote endpoint
of this socket, or null if it is not connected yetgetInetAddress()
,
connect(SocketAddress)
public SocketAddress getLocalSocketAddress()
getLocalSocketAddress
in class Socket
SocketAddress
representing the local endpoint of
this socket, or null if it is not bound yetgetLocalAddress()
,
bind(SocketAddress)
public SocketChannel getChannel()
getChannel
in class Socket
null
if this socket was not created for a channelpublic InputStream getInputStream() throws IOException
InputStreamWrapper
for this socket.
getInputStream
in class Socket
InputStreamWrapper
for reading bytes from this
socket
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 OutputStream getOutputStream() throws IOException
getOutputStream
in class Socket
IOException
- if an I/O error occurs when creating the output stream or if
the socket is not connectedpublic void setTcpNoDelay(boolean aOn) throws SocketException
setTcpNoDelay
in class Socket
aOn
- true
to enable TCP_NODELAY, false
to disable.
SocketException
- if there is an error in the underlying protocol, such as a
TCP error.public boolean getTcpNoDelay() throws SocketException
getTcpNoDelay
in class Socket
boolean
indicating whether or not TCP_NODELAY is
enabled.
SocketException
- if there is an error in the underlying protocol, such as a
TCP error.public void setSoLinger(boolean aOn, int aLinger) throws SocketException
setSoLinger
in class Socket
aOn
- whether or not to linger onaLinger
- how long to linger for, if on is true
SocketException
- if there is an error in the underlying protocol, such as a
TCP errorpublic int getSoLinger() throws SocketException
getSoLinger
in class Socket
SocketException
- if there is an error in the underlying protocol, such as a
TCP errorpublic void sendUrgentData(int aData) throws IOException
sendUrgentData
in class Socket
aData
- The byte of data to send
IOException
- if there is an error sending the data.public void setOOBInline(boolean aOn) throws SocketException
setOOBInline
in class Socket
aOn
- true
to enable OOBINLINE, false to disable.
SocketException
- if there is an error in the underlying protocol, such as a
TCP error.public boolean getOOBInline() throws SocketException
getOOBInline
in class Socket
boolean
indicating whether or not OOBINLINE is
enabled.
SocketException
- if there is an error in the underlying protocol, such as a
TCP error.public void setSoTimeout(int aTimeout) throws SocketException
setSoTimeout
in class Socket
aTimeout
- the specified timeout, in milliseconds.
SocketException
- if there is an error in the underlying protocol, such as a
TCP error.getSoTimeout()
public int getSoTimeout() throws SocketException
getSoTimeout
in class Socket
SocketException
- if there is an error in the underlying protocol, such as a
TCP error.setSoTimeout(int)
public void setSendBufferSize(int aSize) throws SocketException
setSendBufferSize
in class Socket
aSize
- the size to which to set the send buffer size. This value must
be greater than 0.
SocketException
- if there is an error in the underlying protocol, such as a
TCP error.getSendBufferSize()
public int getSendBufferSize() throws SocketException
getSendBufferSize
in class Socket
SocketException
- if there is an error in the underlying protocol, such as a
TCP error.setSendBufferSize(int)
public void setReceiveBufferSize(int aSize) throws SocketException
setReceiveBufferSize
in class Socket
aSize
- the size to which to set the receive buffer size. This value
must be greater than 0.
SocketException
- if there is an error in the underlying protocol, such as a
TCP error.getReceiveBufferSize()
public int getReceiveBufferSize() throws SocketException
getReceiveBufferSize
in class Socket
SocketException
- if there is an error in the underlying protocol, such as a
TCP error.setReceiveBufferSize(int)
public void setKeepAlive(boolean aOn) throws SocketException
setKeepAlive
in class Socket
aOn
- whether or not to have socket keep alive turned on.
SocketException
- if there is an error in the underlying protocol, such as a
TCP error.getKeepAlive()
public boolean getKeepAlive() throws SocketException
getKeepAlive
in class Socket
boolean
indicating whether or not SO_KEEPALIVE
is enabled.
SocketException
- if there is an error in the underlying protocol, such as a
TCP error.setKeepAlive(boolean)
public void setTrafficClass(int aTc) throws SocketException
setTrafficClass
in class Socket
aTc
- an int
value for the bitset.
SocketException
- if there is an error setting the traffic class or
type-of-servicegetTrafficClass()
public int getTrafficClass() throws SocketException
getTrafficClass
in class Socket
SocketException
- if there is an error obtaining the traffic class or
type-of-service value.setTrafficClass(int)
public void setReuseAddress(boolean aOn) throws SocketException
setReuseAddress
in class Socket
aOn
- whether to enable or disable the socket option
SocketException
- if an error occurs enabling or disabling the SO_RESUEADDR
socket option, or the socket is closed.getReuseAddress()
public boolean getReuseAddress() throws SocketException
getReuseAddress
in class Socket
boolean
indicating whether or not SO_REUSEADDR
is enabled.
SocketException
- if there is an error in the underlying protocol, such as a
TCP error.setReuseAddress(boolean)
public void close() throws IOException
close
in class Socket
IOException
- if an I/O error occurs when closing this socket.public void shutdownInput() throws IOException
shutdownInput
in class Socket
IOException
- if an I/O error occurs when shutting down this socket.public void shutdownOutput() throws IOException
shutdownOutput
in class Socket
IOException
- if an I/O error occurs when shutting down this socket.public String toString()
toString
in class Socket
public boolean isConnected()
isConnected
in class Socket
true
if the socket successfuly connected to a
serverpublic boolean isBound()
isBound
in class Socket
true
if the socket successfuly bound to an addresspublic boolean isClosed()
isClosed
in class Socket
true
if the socket has been closedclose()
public boolean isInputShutdown()
isInputShutdown
in class Socket
true
if the input of the socket has been shutdownshutdownInput()
public boolean isOutputShutdown()
isOutputShutdown
in class 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 |