|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.activeio.net.SocketSynchChannel
A SynchChannel
implementation that uses a Socket
to talk to the network.
Field Summary | |
protected static int |
DEFAULT_BUFFER_SIZE
|
Fields inherited from interface org.activeio.Service |
NO_WAIT_TIMEOUT, WAIT_FOREVER_TIMEOUT |
Constructor Summary | |
protected |
SocketSynchChannel(java.net.Socket socket)
|
Method Summary | |
void |
dispose()
This method should not throw any exceptions. |
void |
flush()
Some channels may buffer data which may be sent down if flush() is called. |
java.net.InetAddress |
getInetAddress()
|
boolean |
getKeepAlive()
|
java.net.InetAddress |
getLocalAddress()
|
int |
getLocalPort()
|
java.net.SocketAddress |
getLocalSocketAddress()
|
boolean |
getOOBInline()
|
int |
getPort()
|
int |
getReceiveBufferSize()
|
java.net.SocketAddress |
getRemoteSocketAddress()
|
boolean |
getReuseAddress()
|
int |
getSendBufferSize()
|
int |
getSoLinger()
|
int |
getSoTimeout()
|
boolean |
getTcpNoDelay()
|
int |
getTrafficClass()
|
boolean |
isBound()
|
boolean |
isClosed()
|
boolean |
isConnected()
|
java.lang.Object |
narrow(java.lang.Class target)
Since a Channel may be composed from a chain of other Channel obejcts, this method allows you to query the chain for the specified interface. |
Packet |
read(long timeout)
Used to synchonously receive a packet of information going 'up' the channel. |
void |
setKeepAlive(boolean on)
|
void |
setOOBInline(boolean on)
|
void |
setReceiveBufferSize(int size)
|
void |
setReuseAddress(boolean on)
|
void |
setSendBufferSize(int size)
|
void |
setSoLinger(boolean on,
int linger)
|
protected void |
setSoTimeout(int i)
|
void |
setTcpNoDelay(boolean on)
|
void |
setTrafficClass(int tc)
|
void |
start()
Starts the channel. |
void |
stop(long timeout)
Stops the channel. |
java.lang.String |
toString()
|
void |
write(Packet packet)
Sends a packet down the channel towards the media. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected static final int DEFAULT_BUFFER_SIZE
Constructor Detail |
protected SocketSynchChannel(java.net.Socket socket) throws java.io.IOException
Method Detail |
public Packet read(long timeout) throws java.io.IOException
InputSynchChannel
read
in interface InputSynchChannel
timeout
-
java.io.IOException
InputSynchChannel.read(long)
protected void setSoTimeout(int i) throws java.net.SocketException
java.net.SocketException
public void write(Packet packet) throws java.io.IOException
OutputChannel
write
in interface OutputChannel
packet
-
java.io.IOException
org.activeio.Channel#write(org.activeio.channel.Packet)
public void flush() throws java.io.IOException
OutputChannel
flush
in interface OutputChannel
java.io.IOException
org.activeio.Channel#flush()
public void dispose()
Disposable
dispose
in interface Disposable
Disposable.dispose()
public void start() throws java.io.IOException
Service
start
in interface Service
java.io.IOException
public void stop(long timeout) throws java.io.IOException
Service
stop
in interface Service
timeout
- The amount of time the channel is allowed to take to gracefully stop. If the timeout
is exceeded, the channel should do a forcefull stop.
java.io.IOException
public java.net.InetAddress getInetAddress()
getInetAddress
in interface SocketMetadata
public boolean getKeepAlive() throws java.net.SocketException
getKeepAlive
in interface SocketMetadata
java.net.SocketException
public java.net.InetAddress getLocalAddress()
getLocalAddress
in interface SocketMetadata
public int getLocalPort()
getLocalPort
in interface SocketMetadata
public java.net.SocketAddress getLocalSocketAddress()
getLocalSocketAddress
in interface SocketMetadata
public boolean getOOBInline() throws java.net.SocketException
getOOBInline
in interface SocketMetadata
java.net.SocketException
public int getPort()
getPort
in interface SocketMetadata
public int getReceiveBufferSize() throws java.net.SocketException
getReceiveBufferSize
in interface SocketMetadata
java.net.SocketException
public java.net.SocketAddress getRemoteSocketAddress()
getRemoteSocketAddress
in interface SocketMetadata
public boolean getReuseAddress() throws java.net.SocketException
getReuseAddress
in interface SocketMetadata
java.net.SocketException
public int getSendBufferSize() throws java.net.SocketException
getSendBufferSize
in interface SocketMetadata
java.net.SocketException
public int getSoLinger() throws java.net.SocketException
getSoLinger
in interface SocketMetadata
java.net.SocketException
public int getSoTimeout() throws java.net.SocketException
getSoTimeout
in interface SocketMetadata
java.net.SocketException
public boolean getTcpNoDelay() throws java.net.SocketException
getTcpNoDelay
in interface SocketMetadata
java.net.SocketException
public int getTrafficClass() throws java.net.SocketException
getTrafficClass
in interface SocketMetadata
java.net.SocketException
public boolean isBound()
isBound
in interface SocketMetadata
public boolean isClosed()
isClosed
in interface SocketMetadata
public boolean isConnected()
isConnected
in interface SocketMetadata
public void setKeepAlive(boolean on) throws java.net.SocketException
setKeepAlive
in interface SocketMetadata
java.net.SocketException
public void setOOBInline(boolean on) throws java.net.SocketException
setOOBInline
in interface SocketMetadata
java.net.SocketException
public void setReceiveBufferSize(int size) throws java.net.SocketException
setReceiveBufferSize
in interface SocketMetadata
java.net.SocketException
public void setReuseAddress(boolean on) throws java.net.SocketException
setReuseAddress
in interface SocketMetadata
java.net.SocketException
public void setSendBufferSize(int size) throws java.net.SocketException
setSendBufferSize
in interface SocketMetadata
java.net.SocketException
public void setSoLinger(boolean on, int linger) throws java.net.SocketException
setSoLinger
in interface SocketMetadata
java.net.SocketException
public void setTcpNoDelay(boolean on) throws java.net.SocketException
setTcpNoDelay
in interface SocketMetadata
java.net.SocketException
public void setTrafficClass(int tc) throws java.net.SocketException
setTrafficClass
in interface SocketMetadata
java.net.SocketException
public java.lang.Object narrow(java.lang.Class target)
Channel
narrow
in interface Channel
public java.lang.String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |