Package 

Class TCPReceiver

  • All Implemented Interfaces:
    java.lang.Runnable

    
    public class TCPReceiver
    extends Thread
                        

    Sends and receives all messages to and from server At first it is aimed to use only for signaling Each tcp socket are about to send specific amount of packets. After that the receiver will go to receive only mode. And it will not send any message.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      public boolean runningForMedia
    • Method Summary

      Modifier and Type Method Description
      void run()
      boolean sendMessage(Array<byte> data, int offset, int len) If it is in receive only mode it will not send messageIf social bypass is enabled and this receiver has sent it's allowed number of packetit will not send this message
      boolean isReceiveOnly() return if this receiver is in receive only mode
      boolean isAvailableForSending() Any sender can check if this socket is available for message sending
      void shutdown() Shutdown this receiver.Thank you for your service.
      • 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, onSpinWait, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TCPReceiver

        TCPReceiver(TCPSocketManager tcpSocketManager, InetSocketAddress socketAddress, String extension, ByteArray header, int messageTobeSent, String domain)
        A socket can send maximum @messageTobeSent message
        Parameters:
        tcpSocketManager - the socket manager who is the owner of this tcp receiver.
        socketAddress - the server address it will connect.
        extension - protocol extension it will use to communcate with server.
        header - header that will be prepend in each of the packet it sends to the server.
        messageTobeSent - the count of message this thread is allowed to send to the server.multisocket case.
    • Method Detail

      • run

         void run()
      • sendMessage

         boolean sendMessage(Array<byte> data, int offset, int len)

        If it is in receive only mode it will not send messageIf social bypass is enabled and this receiver has sent it's allowed number of packetit will not send this message

        Parameters:
        data - byte array that is to be sent.
        offset - offset of the @param data
        len - length of the data to be sent.
      • isReceiveOnly

         boolean isReceiveOnly()

        return if this receiver is in receive only mode

      • isAvailableForSending

         boolean isAvailableForSending()

        Any sender can check if this socket is available for message sending

      • shutdown

         void shutdown()

        Shutdown this receiver.Thank you for your service.