|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.activeio.net.SocketSyncChannel
public class SocketSyncChannel
A org.activeio.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 |
Fields inherited from interface org.activeio.Service |
---|
NO_WAIT_TIMEOUT, WAIT_FOREVER_TIMEOUT |
Constructor Summary | |
---|---|
protected |
SocketSyncChannel(Socket socket)
|
|
SocketSyncChannel(SocketStreamChannel channel)
|
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. |
InetAddress |
getInetAddress()
|
boolean |
getKeepAlive()
|
InetAddress |
getLocalAddress()
|
int |
getLocalPort()
|
SocketAddress |
getLocalSocketAddress()
|
boolean |
getOOBInline()
|
int |
getPort()
|
int |
getReceiveBufferSize()
|
SocketAddress |
getRemoteSocketAddress()
|
boolean |
getReuseAddress()
|
int |
getSendBufferSize()
|
int |
getSoLinger()
|
int |
getSoTimeout()
|
boolean |
getTcpNoDelay()
|
int |
getTrafficClass()
|
boolean |
isBound()
|
boolean |
isClosed()
|
boolean |
isConnected()
|
Object |
narrow(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 synchronously 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. |
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 SocketSyncChannel(Socket socket) throws IOException
IOException
public SocketSyncChannel(SocketStreamChannel channel) throws IOException
IOException
Method Detail |
---|
public Packet read(long timeout) throws IOException
InputSyncChannel
read
in interface InputSyncChannel
IOException
org.activeio.SynchChannel#read(long)
protected void setSoTimeout(int i) throws SocketException
SocketException
public void write(Packet packet) throws IOException
OutputChannel
write
in interface OutputChannel
IOException
org.activeio.Channel#write(org.activeio.Packet)
public void flush() throws IOException
OutputChannel
flush
in interface OutputChannel
IOException
org.activeio.Channel#flush()
public void dispose()
Disposable
dispose
in interface Disposable
Disposable.dispose()
public void start() throws IOException
Service
start
in interface Service
IOException
public void stop(long timeout) throws 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.
IOException
public InetAddress getInetAddress()
getInetAddress
in interface SocketMetadata
public boolean getKeepAlive() throws SocketException
getKeepAlive
in interface SocketMetadata
SocketException
public InetAddress getLocalAddress()
getLocalAddress
in interface SocketMetadata
public int getLocalPort()
getLocalPort
in interface SocketMetadata
public SocketAddress getLocalSocketAddress()
getLocalSocketAddress
in interface SocketMetadata
public boolean getOOBInline() throws SocketException
getOOBInline
in interface SocketMetadata
SocketException
public int getPort()
getPort
in interface SocketMetadata
public int getReceiveBufferSize() throws SocketException
getReceiveBufferSize
in interface SocketMetadata
SocketException
public SocketAddress getRemoteSocketAddress()
getRemoteSocketAddress
in interface SocketMetadata
public boolean getReuseAddress() throws SocketException
getReuseAddress
in interface SocketMetadata
SocketException
public int getSendBufferSize() throws SocketException
getSendBufferSize
in interface SocketMetadata
SocketException
public int getSoLinger() throws SocketException
getSoLinger
in interface SocketMetadata
SocketException
public int getSoTimeout() throws SocketException
getSoTimeout
in interface SocketMetadata
SocketException
public boolean getTcpNoDelay() throws SocketException
getTcpNoDelay
in interface SocketMetadata
SocketException
public int getTrafficClass() throws SocketException
getTrafficClass
in interface SocketMetadata
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 SocketException
setKeepAlive
in interface SocketMetadata
SocketException
public void setOOBInline(boolean on) throws SocketException
setOOBInline
in interface SocketMetadata
SocketException
public void setReceiveBufferSize(int size) throws SocketException
setReceiveBufferSize
in interface SocketMetadata
SocketException
public void setReuseAddress(boolean on) throws SocketException
setReuseAddress
in interface SocketMetadata
SocketException
public void setSendBufferSize(int size) throws SocketException
setSendBufferSize
in interface SocketMetadata
SocketException
public void setSoLinger(boolean on, int linger) throws SocketException
setSoLinger
in interface SocketMetadata
SocketException
public void setTcpNoDelay(boolean on) throws SocketException
setTcpNoDelay
in interface SocketMetadata
SocketException
public void setTrafficClass(int tc) throws SocketException
setTrafficClass
in interface SocketMetadata
SocketException
public Object narrow(Class target)
Channel
narrow
in interface Channel
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |