cdac.medinfo.sdk.hl7282.hl7net.communication

## Class ClientSideNetworkAgent

- java.lang.Object
- - java.lang.Thread
  - - cdac.medinfo.sdk.hl7282.hl7net.communication.ClientSideNetworkAgent

- All Implemented Interfaces:
    INetworkAgent, java.lang.Runnable

      public class ClientSideNetworkAgent
      extends java.lang.Thread
      implements INetworkAgent

  ClientSideNetworkAgent contains all methods required for Client Session to interact with Network Layer.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.lang.Thread

      `java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler`

  - ### Field Summary

    - ### Fields inherited from class java.lang.Thread

      `MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClientSideNetworkAgent()` Instantiates a new ClientSideNetworkAgent.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addBufferReceiver(IBufferReceiver objIMessageBufferReceiver)` Sets IBufferReceiver on AuxAgent.
    `void` | `close()` Closes the socket.
    `void` | `connect(java.net.SocketAddress objSocketAddress, int itimeout)` Connect to specified socket address
    `java.io.InputStream` | `getSocketInputstream()` Retrieves Socket InputStream
    `java.io.OutputStream` | `getSocketOutputstream()` Retrieves Socket OutputStream
    `void` | `read()` Reads Data From Input Stream of Underlying Socket with Packet Size of 1MB.
    `void` | `run()` Run method
    `void` | `setConnectionListener(IConnectionListener objIConnectionListener)` Sets ConnectionListener.
    `void` | `setReadWriteLength(int iReadLength, int iWriteLength)` Sets max length limit of reading.
    `void` | `setSocketInputstream(java.io.InputStream socketInputstream)` Sets SocketInputStream
    `void` | `setSocketOutputstream(java.io.OutputStream socketOutputstream)` Sets Socket InputStream
    `void` | `write(byte[] buffer)` Writes data on Output Stream of Underlying Socket.

    - ### Methods inherited from class java.lang.Thread

      `activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ClientSideNetworkAgent

          public ClientSideNetworkAgent()
                                 throws java.io.IOException

      Instantiates a new ClientSideNetworkAgent.
      Throws:
        `java.io.IOException` - Signals that an IO Exception has occurred.

  - ### Method Detail

    - #### getSocketInputstream

          public java.io.InputStream getSocketInputstream()

      Retrieves Socket InputStream
      Returns:
        InputStream - instance of InputStream

    - #### setSocketInputstream

          public void setSocketInputstream(java.io.InputStream socketInputstream)

      Sets SocketInputStream
      Parameters:
        `socketInputstream` - instance of InputStream

    - #### getSocketOutputstream

          public java.io.OutputStream getSocketOutputstream()

      Retrieves Socket OutputStream
      Returns:
        OutputStream - instance of OutputStream

    - #### setSocketOutputstream

          public void setSocketOutputstream(java.io.OutputStream socketOutputstream)

      Sets Socket InputStream
      Parameters:
        `socketOutputstream` - instance of OutputStream

    - #### setReadWriteLength

          public void setReadWriteLength(int iReadLength,
                                int iWriteLength)

      Sets max length limit of reading.
      Parameters:
        `iReadLength` - value of Reading max length
        `iWriteLength` - value of Writing max length

    - #### setConnectionListener

          public void setConnectionListener(IConnectionListener objIConnectionListener)

      Sets ConnectionListener.
      Specified by:
        `setConnectionListener` in interface `INetworkAgent`
      Parameters:
        `IConnectionListener` -

    - #### run

          public void run()

      Run method
      Specified by:
        `run` in interface `java.lang.Runnable`
      Overrides:
        `run` in class `java.lang.Thread`

    - #### connect

          public void connect(java.net.SocketAddress objSocketAddress,
                     int itimeout)
                       throws java.io.IOException

      Connect to specified socket address
      Parameters:
        `objSocketAddress` - the obj socket address
      Throws:
        `java.io.IOException` - Signals that an I/O exception has occurred.

    - #### read

          public void read()
                    throws java.lang.InterruptedException,
                           java.io.IOException

      Reads Data From Input Stream of Underlying Socket with Packet Size of 1MB.
      Specified by:
        `read` in interface `INetworkAgent`
      Throws:
        `java.lang.InterruptedException` - thrown when read operation is interrupted
        `java.io.IOException` - Signals that an IO Exception has occurred.

    - #### addBufferReceiver

          public void addBufferReceiver(IBufferReceiver objIMessageBufferReceiver)

      Sets IBufferReceiver on AuxAgent.
      Parameters:
        `objIMessageBufferReceiver` - object of Buffer Receiver.

    - #### write

          public void write(byte[] buffer)
                     throws java.io.IOException

      Writes data on Output Stream of Underlying Socket.
      Specified by:
        `write` in interface `INetworkAgent`
      Parameters:
        `buffer` - the buffer to be written.
      Throws:
        `java.io.IOException` - Signals that an IO Exception has occurred.

    - #### close

          public void close()
                     throws java.io.IOException

      Closes the socket.
      Throws:
        `java.io.IOException`