|
|||||||||||
| 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 InputSynchChanneltimeout -
java.io.IOExceptionInputSynchChannel.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 OutputChannelpacket -
java.io.IOExceptionorg.activeio.Channel#write(org.activeio.channel.Packet)
public void flush()
throws java.io.IOException
OutputChannel
flush in interface OutputChanneljava.io.IOExceptionorg.activeio.Channel#flush()public void dispose()
Disposable
dispose in interface DisposableDisposable.dispose()
public void start()
throws java.io.IOException
Service
start in interface Servicejava.io.IOException
public void stop(long timeout)
throws java.io.IOException
Service
stop in interface Servicetimeout - 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.IOExceptionpublic java.net.InetAddress getInetAddress()
getInetAddress in interface SocketMetadata
public boolean getKeepAlive()
throws java.net.SocketException
getKeepAlive in interface SocketMetadatajava.net.SocketExceptionpublic java.net.InetAddress getLocalAddress()
getLocalAddress in interface SocketMetadatapublic int getLocalPort()
getLocalPort in interface SocketMetadatapublic java.net.SocketAddress getLocalSocketAddress()
getLocalSocketAddress in interface SocketMetadata
public boolean getOOBInline()
throws java.net.SocketException
getOOBInline in interface SocketMetadatajava.net.SocketExceptionpublic int getPort()
getPort in interface SocketMetadata
public int getReceiveBufferSize()
throws java.net.SocketException
getReceiveBufferSize in interface SocketMetadatajava.net.SocketExceptionpublic java.net.SocketAddress getRemoteSocketAddress()
getRemoteSocketAddress in interface SocketMetadata
public boolean getReuseAddress()
throws java.net.SocketException
getReuseAddress in interface SocketMetadatajava.net.SocketException
public int getSendBufferSize()
throws java.net.SocketException
getSendBufferSize in interface SocketMetadatajava.net.SocketException
public int getSoLinger()
throws java.net.SocketException
getSoLinger in interface SocketMetadatajava.net.SocketException
public int getSoTimeout()
throws java.net.SocketException
getSoTimeout in interface SocketMetadatajava.net.SocketException
public boolean getTcpNoDelay()
throws java.net.SocketException
getTcpNoDelay in interface SocketMetadatajava.net.SocketException
public int getTrafficClass()
throws java.net.SocketException
getTrafficClass in interface SocketMetadatajava.net.SocketExceptionpublic boolean isBound()
isBound in interface SocketMetadatapublic boolean isClosed()
isClosed in interface SocketMetadatapublic boolean isConnected()
isConnected in interface SocketMetadata
public void setKeepAlive(boolean on)
throws java.net.SocketException
setKeepAlive in interface SocketMetadatajava.net.SocketException
public void setOOBInline(boolean on)
throws java.net.SocketException
setOOBInline in interface SocketMetadatajava.net.SocketException
public void setReceiveBufferSize(int size)
throws java.net.SocketException
setReceiveBufferSize in interface SocketMetadatajava.net.SocketException
public void setReuseAddress(boolean on)
throws java.net.SocketException
setReuseAddress in interface SocketMetadatajava.net.SocketException
public void setSendBufferSize(int size)
throws java.net.SocketException
setSendBufferSize in interface SocketMetadatajava.net.SocketException
public void setSoLinger(boolean on,
int linger)
throws java.net.SocketException
setSoLinger in interface SocketMetadatajava.net.SocketException
public void setTcpNoDelay(boolean on)
throws java.net.SocketException
setTcpNoDelay in interface SocketMetadatajava.net.SocketException
public void setTrafficClass(int tc)
throws java.net.SocketException
setTrafficClass in interface SocketMetadatajava.net.SocketExceptionpublic java.lang.Object narrow(java.lang.Class target)
Channel
narrow in interface Channelpublic java.lang.String toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||