|
||||||||||
| 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 InputSyncChannelIOExceptionorg.activeio.SynchChannel#read(long)
protected void setSoTimeout(int i)
throws SocketException
SocketException
public void write(Packet packet)
throws IOException
OutputChannel
write in interface OutputChannelIOExceptionorg.activeio.Channel#write(org.activeio.Packet)
public void flush()
throws IOException
OutputChannel
flush in interface OutputChannelIOExceptionorg.activeio.Channel#flush()public void dispose()
Disposable
dispose in interface DisposableDisposable.dispose()
public void start()
throws IOException
Service
start in interface ServiceIOException
public void stop(long timeout)
throws 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.
IOExceptionpublic InetAddress getInetAddress()
getInetAddress in interface SocketMetadata
public boolean getKeepAlive()
throws SocketException
getKeepAlive in interface SocketMetadataSocketExceptionpublic InetAddress getLocalAddress()
getLocalAddress in interface SocketMetadatapublic int getLocalPort()
getLocalPort in interface SocketMetadatapublic SocketAddress getLocalSocketAddress()
getLocalSocketAddress in interface SocketMetadata
public boolean getOOBInline()
throws SocketException
getOOBInline in interface SocketMetadataSocketExceptionpublic int getPort()
getPort in interface SocketMetadata
public int getReceiveBufferSize()
throws SocketException
getReceiveBufferSize in interface SocketMetadataSocketExceptionpublic SocketAddress getRemoteSocketAddress()
getRemoteSocketAddress in interface SocketMetadata
public boolean getReuseAddress()
throws SocketException
getReuseAddress in interface SocketMetadataSocketException
public int getSendBufferSize()
throws SocketException
getSendBufferSize in interface SocketMetadataSocketException
public int getSoLinger()
throws SocketException
getSoLinger in interface SocketMetadataSocketException
public int getSoTimeout()
throws SocketException
getSoTimeout in interface SocketMetadataSocketException
public boolean getTcpNoDelay()
throws SocketException
getTcpNoDelay in interface SocketMetadataSocketException
public int getTrafficClass()
throws SocketException
getTrafficClass in interface SocketMetadataSocketExceptionpublic boolean isBound()
isBound in interface SocketMetadatapublic boolean isClosed()
isClosed in interface SocketMetadatapublic boolean isConnected()
isConnected in interface SocketMetadata
public void setKeepAlive(boolean on)
throws SocketException
setKeepAlive in interface SocketMetadataSocketException
public void setOOBInline(boolean on)
throws SocketException
setOOBInline in interface SocketMetadataSocketException
public void setReceiveBufferSize(int size)
throws SocketException
setReceiveBufferSize in interface SocketMetadataSocketException
public void setReuseAddress(boolean on)
throws SocketException
setReuseAddress in interface SocketMetadataSocketException
public void setSendBufferSize(int size)
throws SocketException
setSendBufferSize in interface SocketMetadataSocketException
public void setSoLinger(boolean on,
int linger)
throws SocketException
setSoLinger in interface SocketMetadataSocketException
public void setTcpNoDelay(boolean on)
throws SocketException
setTcpNoDelay in interface SocketMetadataSocketException
public void setTrafficClass(int tc)
throws SocketException
setTrafficClass in interface SocketMetadataSocketExceptionpublic Object narrow(Class target)
Channel
narrow in interface Channelpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||