SocketSynchChannel (ActiveIO 1.0 API)
Keywords: org.activeio.net.SocketSynchChannel class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.activeio.net
Class SocketSynchChannel

    java.lang.Object
      org.activeio.net.SocketSynchChannel

All Implemented Interfaces:
  Channel, Disposable, InputSynchChannel, OutputChannel, Service, SocketMetadata, SynchChannel

public class SocketSynchChannel
extends java.lang.Object
implements SynchChannel, SocketMetadata

A `SynchChannel` implementation that uses a `Socket` to talk to the network.

Version:
  $Revision$

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

### DEFAULT_BUFFER_SIZE

    protected static final int DEFAULT_BUFFER_SIZE

See Also:
  Constant Field Values

Constructor Detail

### SocketSynchChannel

    protected SocketSynchChannel(java.net.Socket socket)
                          throws java.io.IOException

Method Detail

### read

    public Packet read(long timeout)
                throws java.io.IOException

  Description copied from interface: `InputSynchChannel`
  Used to synchonously receive a packet of information going 'up' the channel. This method blocks until a packet is received or the operation experiences timeout.

  Specified by:
    `read` in interface `InputSynchChannel`
  Parameters:
    `timeout` -
  Returns:
    the packet recived or null if the timeout occured.
  Throws:
    `java.io.IOException`
  See Also:
    `InputSynchChannel.read(long)`

### setSoTimeout

    protected void setSoTimeout(int i)
                         throws java.net.SocketException

  Throws:
    `java.net.SocketException`

### write

    public void write(Packet packet)
               throws java.io.IOException

  Description copied from interface: `OutputChannel`
  Sends a packet down the channel towards the media.

  Specified by:
    `write` in interface `OutputChannel`
  Parameters:
    `packet` -
  Throws:
    `java.io.IOException`
  See Also:
    `org.activeio.Channel#write(org.activeio.channel.Packet)`

### flush

    public void flush()
               throws java.io.IOException

  Description copied from interface: `OutputChannel`
  Some channels may buffer data which may be sent down if flush() is called.

  Specified by:
    `flush` in interface `OutputChannel`
  Throws:
    `java.io.IOException`
  See Also:
    `org.activeio.Channel#flush()`

### dispose

    public void dispose()

  Description copied from interface: `Disposable`
  This method should not throw any exceptions. Cleaning up a Disposable object should be easy of an end user therefore do not make him have to handle an Exception.

  Specified by:
    `dispose` in interface `Disposable`
  See Also:
    `Disposable.dispose()`

### start

    public void start()
               throws java.io.IOException

  Description copied from interface: `Service`
  Starts the channel. Once started, the channel is in the running state.

  Specified by:
    `start` in interface `Service`
  Throws:
    `java.io.IOException`

### stop

    public void stop(long timeout)
              throws java.io.IOException

  Description copied from interface: `Service`
  Stops the channel. Once stopped, the channel is in the stopped state.

  Specified by:
    `stop` in interface `Service`
  Parameters:
    `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.
  Throws:
    `java.io.IOException`

### getInetAddress

    public java.net.InetAddress getInetAddress()

  Specified by:
    `getInetAddress` in interface `SocketMetadata`

### getKeepAlive

    public boolean getKeepAlive()
                         throws java.net.SocketException

  Specified by:
    `getKeepAlive` in interface `SocketMetadata`
  Throws:
    `java.net.SocketException`

### getLocalAddress

    public java.net.InetAddress getLocalAddress()

  Specified by:
    `getLocalAddress` in interface `SocketMetadata`

### getLocalPort

    public int getLocalPort()

  Specified by:
    `getLocalPort` in interface `SocketMetadata`

### getLocalSocketAddress

    public java.net.SocketAddress getLocalSocketAddress()

  Specified by:
    `getLocalSocketAddress` in interface `SocketMetadata`

### getOOBInline

    public boolean getOOBInline()
                         throws java.net.SocketException

  Specified by:
    `getOOBInline` in interface `SocketMetadata`
  Throws:
    `java.net.SocketException`

### getPort

    public int getPort()

  Specified by:
    `getPort` in interface `SocketMetadata`

### getReceiveBufferSize

    public int getReceiveBufferSize()
                             throws java.net.SocketException

  Specified by:
    `getReceiveBufferSize` in interface `SocketMetadata`
  Throws:
    `java.net.SocketException`

### getRemoteSocketAddress

    public java.net.SocketAddress getRemoteSocketAddress()

  Specified by:
    `getRemoteSocketAddress` in interface `SocketMetadata`

### getReuseAddress

    public boolean getReuseAddress()
                            throws java.net.SocketException

  Specified by:
    `getReuseAddress` in interface `SocketMetadata`
  Throws:
    `java.net.SocketException`

### getSendBufferSize

    public int getSendBufferSize()
                          throws java.net.SocketException

  Specified by:
    `getSendBufferSize` in interface `SocketMetadata`
  Throws:
    `java.net.SocketException`

### getSoLinger

    public int getSoLinger()
                    throws java.net.SocketException

  Specified by:
    `getSoLinger` in interface `SocketMetadata`
  Throws:
    `java.net.SocketException`

### getSoTimeout

    public int getSoTimeout()
                     throws java.net.SocketException

  Specified by:
    `getSoTimeout` in interface `SocketMetadata`
  Throws:
    `java.net.SocketException`

### getTcpNoDelay

    public boolean getTcpNoDelay()
                          throws java.net.SocketException

  Specified by:
    `getTcpNoDelay` in interface `SocketMetadata`
  Throws:
    `java.net.SocketException`

### getTrafficClass

    public int getTrafficClass()
                        throws java.net.SocketException

  Specified by:
    `getTrafficClass` in interface `SocketMetadata`
  Throws:
    `java.net.SocketException`

### isBound

    public boolean isBound()

  Specified by:
    `isBound` in interface `SocketMetadata`

### isClosed

    public boolean isClosed()

  Specified by:
    `isClosed` in interface `SocketMetadata`

### isConnected

    public boolean isConnected()

  Specified by:
    `isConnected` in interface `SocketMetadata`

### setKeepAlive

    public void setKeepAlive(boolean on)
                      throws java.net.SocketException

  Specified by:
    `setKeepAlive` in interface `SocketMetadata`
  Throws:
    `java.net.SocketException`

### setOOBInline

    public void setOOBInline(boolean on)
                      throws java.net.SocketException

  Specified by:
    `setOOBInline` in interface `SocketMetadata`
  Throws:
    `java.net.SocketException`

### setReceiveBufferSize

    public void setReceiveBufferSize(int size)
                              throws java.net.SocketException

  Specified by:
    `setReceiveBufferSize` in interface `SocketMetadata`
  Throws:
    `java.net.SocketException`

### setReuseAddress

    public void setReuseAddress(boolean on)
                         throws java.net.SocketException

  Specified by:
    `setReuseAddress` in interface `SocketMetadata`
  Throws:
    `java.net.SocketException`

### setSendBufferSize

    public void setSendBufferSize(int size)
                           throws java.net.SocketException

  Specified by:
    `setSendBufferSize` in interface `SocketMetadata`
  Throws:
    `java.net.SocketException`

### setSoLinger

    public void setSoLinger(boolean on,
                            int linger)
                     throws java.net.SocketException

  Specified by:
    `setSoLinger` in interface `SocketMetadata`
  Throws:
    `java.net.SocketException`

### setTcpNoDelay

    public void setTcpNoDelay(boolean on)
                       throws java.net.SocketException

  Specified by:
    `setTcpNoDelay` in interface `SocketMetadata`
  Throws:
    `java.net.SocketException`

### setTrafficClass

    public void setTrafficClass(int tc)
                         throws java.net.SocketException

  Specified by:
    `setTrafficClass` in interface `SocketMetadata`
  Throws:
    `java.net.SocketException`

### narrow

    public java.lang.Object narrow(java.lang.Class target)

  Description copied from interface: `Channel`
  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. The first Channel in the chain the implments the requested interface will be return an implementing object. If no Channel in the chain implements the requested class, then null is returned.

  Specified by:
    `narrow` in interface `Channel`

### toString

    public java.lang.String toString()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © -2005 The ActiveIO Project. All Rights Reserved.